Consolidate docsite/storybook CI/CD workflows (#1217)

This commit is contained in:
Evan Simkowitz 2024-11-06 11:36:08 -08:00 committed by GitHub
parent 66675fc3e5
commit b306eab0d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 39 deletions

View File

@ -1,4 +1,6 @@
name: Deploy Docsite and Storybook name: Docsite and Storybook CI/CD
run-name: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'Build and Deploy' || 'Test Build' }} Docsite and Storybook
env: env:
NODE_VERSION: 20 NODE_VERSION: 20
@ -7,9 +9,17 @@ on:
push: push:
branches: branches:
- main - main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
workflow_dispatch: workflow_dispatch:
# Also run any time a PR is opened targeting the docs or storybook resources
pull_request:
branches:
- main
paths:
- "docs/**"
- "storybook/**"
- "**/*.story.*"
- "**/*.stories.*"
- ".github/workflows/deploy-docsite.yml"
jobs: jobs:
build: build:
@ -37,11 +47,15 @@ jobs:
- name: Copy Storybook to docs - name: Copy Storybook to docs
run: cp -r storybook-static docs/build/storybook && cp -r assets docs/build/assets/assets run: cp -r storybook-static docs/build/storybook && cp -r assets docs/build/assets/assets
- name: Upload Build Artifact - name: Upload Build Artifact
# Only upload the build artifact when pushed to the main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
path: docs/build path: docs/build
deploy: deploy:
name: Deploy to GitHub Pages name: Deploy to GitHub Pages
# Only deploy when pushed to the main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions: permissions:

View File

@ -1,36 +0,0 @@
name: Test Docsite and Storybook Build
env:
NODE_VERSION: 20
on:
pull_request:
branches:
- main
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
paths:
- "docs/**"
- "storybook/**"
- "**/*.story.*"
- "**/*.stories.*"
jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{env.NODE_VERSION}}
- name: Install yarn
run: |
corepack enable
yarn install
- name: Test build website
run: yarn build
working-directory: docs/
- name: Test build storybook
run: yarn build-storybook