Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions docs/_snippets/ghp-github-action.md
Comment thread
sekeidesign marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
```yml filename=".github/workflows/deploy-github-pages.yml" renderer="common" language="js"
# Workflow name
name: Build and Publish Storybook to GitHub Pages

on:
# Event for the workflow to run on
push:
branches:
- 'your-branch-name' # Replace with the branch you want to deploy from

- "your-branch-name" # Use specific branch name
permissions:
contents: read
pages: write
id-token: write

# List of jobs
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
# Job steps
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
# Manual Checkout
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Set up Node
- uses: actions/setup-node@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
#👇 Add Storybook build and deploy to GitHub Pages as a step in the workflow
- uses: bitovi/github-actions-storybook-to-github-pages@v1.0.3
node-version: "20"
cache: "npm" # Adjust caching strategy and configuration if using other package managers
- name: Install dependencies
run: npm ci # Replace with appropriate command if using other package managers
- name: Build Storybook
run: npm run build-storybook
# Upload pages artifact
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
install_command: yarn install # default: npm ci
build_command: yarn build-storybook # default: npm run build-storybook
path: storybook-static # default: dist/storybook
checkout: false # default: true
path: "storybook-static"
# Deploy to Github Pages
- id: deploy
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
with:
token: ${{ github.token }}
```