-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated the workflow to deploy Storybook
to GitHub pages.
- Loading branch information
Showing
1 changed file
with
33 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,35 @@ | ||
name: 'Chromatic GitHub Deployment' | ||
|
||
# Workflow name | ||
name: Build and Publish Storybook to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
# Event for the workflow to run on | ||
push: | ||
branches: | ||
- storybook-to-ghpage # Replace with the branch you want to deploy from | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# List of jobs | ||
jobs: | ||
chromatic: | ||
name: Run Chromatic | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
# ⚠️ See your package manager's documentation for the correct command to install dependencies in a CI environment. | ||
run: npm install && npm run build && npm run build-storybook && npm run deploy-storybook -- --ci | ||
env: | ||
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run Chromatic | ||
uses: chromaui/action@latest | ||
with: | ||
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
zip: true | ||
onlyChanged: true # 👈 Required option to enable TurboSnap | ||
deploy: | ||
runs-on: ubuntu-latest | ||
# Job steps | ||
steps: | ||
# Manual Checkout | ||
- uses: actions/checkout@v4 | ||
|
||
# Set up Node | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
|
||
#👇 Add Storybook build and deploy to GitHub Pages as a step in the workflow | ||
- uses: bitovi/[email protected] | ||
with: | ||
install_command: npm install # default: npm ci | ||
build_command: npm run build-storybook # default: npm run build-storybook | ||
path: storybook-static # default: dist/storybook | ||
checkout: false # default: true |