diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 120a986..aedc1e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,20 +27,3 @@ jobs: env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN}} - - build-and-deploy-sb: - runs-on: ubuntu-latest - if: github.event.pull_request.merged == true - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Install and Build - run: | - npm install - npm run deploy-storybook - - - name: Deploy - with: - branch: gh-pages - folder: storybook-static # output folder from `npm run build-storybook` \ No newline at end of file diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml new file mode 100644 index 0000000..0228fe7 --- /dev/null +++ b/.github/workflows/storybook.yml @@ -0,0 +1,52 @@ +name: Build & deploy + +on: + pull_request: + branches: + - main + types: [closed] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Node.js + uses: actions/setup-node@v1 + with: + node-version: 13.x + + - name: Install NPM packages + run: npm ci + + - name: Build project + run: npm run build-storybook + + - name: Upload production-ready build files + uses: actions/upload-artifact@v2 + with: + name: production-files + path: ./storybook-static + + deploy: + name: Deploy + needs: build + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + + steps: + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: production-files + path: ./storybook-static + + - name: Deploy to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./storybook-static \ No newline at end of file