Build & Release v4.2.1 #56
This file contains hidden or 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
# Workflow name | |
name: Build and Publish Storybook to GitHub Pages | |
on: | |
# Event for the workflow to run on | |
push: | |
branches: | |
- "main" # Replace with the branch you want to deploy from | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# List of jobs | |
jobs: | |
retrieve_pages_url: | |
runs-on: ubuntu-latest | |
outputs: | |
pages_url: ${{ steps.get_url.outputs.url }} | |
steps: | |
- id: get_url | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
url=$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url') | |
echo "url=$url" >> "$GITHUB_OUTPUT" | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deploy.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: retrieve_pages_url | |
# Job steps | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install bun | |
uses: oven-sh/setup-bun@v2 | |
- name: Install dependencies | |
run: bun install --frozen-lockfile | |
shell: bash | |
# Build | |
- id: build | |
env: | |
PAGES_URL: ${{ needs.retrieve_pages_url.outputs.pages_url }} | |
run: bun build-storybook | |
# Upload | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "storybook-static" | |
# Deploy | |
- id: deploy | |
name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 |