Skip to content

apply review

apply review #884

name: Publish preview Storybook to GitHub Pages
on:
push:
branches-ignore:
- main
permissions:
contents: read
env:
TARGET_PATH: "/storybook/${{ github.ref_name }}"
BASE_PATH: "/flow-previews/storybook/${{ github.ref_name }}"
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages-preview-storybook
url: https://mittwald.github.io${{ env.BASE_PATH }}
env:
PUBLISH_PAT: ${{ secrets.PUBLISH_PAT }}
GH_TOKEN: ${{ secrets.PUBLISH_PAT }}
steps:
- name: Checkout ⬇️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node 🎛️
uses: actions/setup-node@v4
with:
node-version: 20
cache: "yarn"
registry-url: "https://registry.npmjs.org"
- name: Git Identity 🪪
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Install Dependencies 📦️
run: yarn install --immutable
- name: Setup NX 1/2 🎛️
uses: nrwl/nx-set-shas@v4
- name: Setup NX 2/2 🎛
if: github.ref != 'refs/heads/main'
run: git branch --track main origin/main
- name: Build 🔨
run: yarn build --exclude @mittwald/flow-documentation
- name: Build Storybook 🔨
run: yarn components build:storybook
- name: Upload files to GitHub Pages 🚀
uses: maaaathis/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.PUBLISH_PAT }}
with:
source-directory: packages/components/storybook-static
destination-github-username: mittwald
destination-repository-name: flow-previews
target-branch: main
target-directory: "${{ env.TARGET_PATH }}"
- name: Output the URL
run: echo "${{ job.environment.url }}"