From 46356c246a5d87780a72071a4b51316fc4c1b306 Mon Sep 17 00:00:00 2001 From: bipoza Date: Wed, 18 May 2022 15:08:36 +0200 Subject: [PATCH 1/2] storybook CI --- .github/workflows/release.yml | 17 ----------- .github/workflows/storybook.yml | 54 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/storybook.yml 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..6de0d1f --- /dev/null +++ b/.github/workflows/storybook.yml @@ -0,0 +1,54 @@ +name: Build & deploy + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + 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 From 247e95aca129613d5e08a8b5a9390169d536997f Mon Sep 17 00:00:00 2001 From: bipoza Date: Wed, 18 May 2022 15:11:15 +0200 Subject: [PATCH 2/2] storybook CI after merge to main --- .github/workflows/storybook.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 6de0d1f..0228fe7 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -1,18 +1,16 @@ name: Build & deploy on: - push: - branches: - - main 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