Skip to content

Commit

Permalink
Use github actions for pages deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
duttonw committed Mar 29, 2024
1 parent aa5591a commit 31d52af
Showing 1 changed file with 32 additions and 10 deletions.
42 changes: 32 additions & 10 deletions .github/workflows/storybook-deploy.js.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
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
actions: read
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

Expand Down Expand Up @@ -69,11 +80,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@v3
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/[email protected]

# - 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

0 comments on commit 31d52af

Please sign in to comment.