From c0a11cb0fce4291f066753d8b2fc52b7da0e8c57 Mon Sep 17 00:00:00 2001 From: william dutton Date: Fri, 29 Mar 2024 13:15:09 +1000 Subject: [PATCH] Use github actions for pages deployment --- .github/workflows/storybook-deploy.js.yml | 41 +++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/storybook-deploy.js.yml b/.github/workflows/storybook-deploy.js.yml index 00e1eb65..486f88f6 100644 --- a/.github/workflows/storybook-deploy.js.yml +++ b/.github/workflows/storybook-deploy.js.yml @@ -1,24 +1,34 @@ name: Storybook deploy on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: workflow_run: workflows: [Build and Test] # Reuse the name of your tests workflow branches: [main, develop] types: [completed ] +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + concurrency: group: deploy-${{ github.workflow }}-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. - cancel-in-progress: true + cancel-in-progress: false jobs: deploy: - + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest strategy: matrix: node: [ '20' ] name: Deploy with Node ${{ matrix.node }} - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} steps: - uses: actions/checkout@v4 @@ -69,11 +79,22 @@ jobs: with: name: Storybook path: storybook-static - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4 + + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages # The branch the action should deploy to. - FOLDER: storybook-static # The folder that the build-storybook script generates files. - CLEAN: true # Automatically remove deleted files from the deploy branch - TARGET_FOLDER: docs # The folder that we serve our Storybook files from + path: "./storybook-static" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4.0.5 + +# - name: Deploy 🚀 #to branch for old website deployment +# uses: JamesIves/github-pages-deploy-action@v4 +# with: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# BRANCH: gh-pages # The branch the action should deploy to. +# FOLDER: storybook-static # The folder that the build-storybook script generates files. +# CLEAN: true # Automatically remove deleted files from the deploy branch +# TARGET_FOLDER: docs # The folder that we serve our Storybook files from