Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add storybook build workflow #277

Merged
Merged
Show file tree
Hide file tree
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
25 changes: 25 additions & 0 deletions .github/workflows/storybook-build-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Storybook (Fork)
on:
pull_request:
branches:
- 'main'
jobs:
build-storybooks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci
- name: Build PIA Storybook
run: npx nx run portal-integration-angular:build-storybook
- name: Build AA Storybook
run: npx nx run angular-accelerator:build-storybook
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: storybook-dist
path: dist/storybook/

39 changes: 39 additions & 0 deletions .github/workflows/storybook-deploy-fork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy Storybook (Fork)
on:
workflow_run:
workflows: ["Build Storybook (Fork)"]
types:
- completed
jobs:
deploy-storybook:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment: Storybook
env:
PIA_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN_PIA }}
AA_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN_AA }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download build artifacts
uses: dawidd6/action-download-artifact@v3
with:
run_id: ${{ github.event.workflow_run.id }}
name: storybook-dist
- name: Publish to PIA Chromatic
uses: chromaui/action@latest
if: env.PIA_TOKEN != null
with:
projectToken: ${{ env.PIA_TOKEN }}
storybookBuildDir: storybook-dist/portal-integration-angular
skip: 'dependabot/**'
- name: Publish to AA Chromatic
uses: chromaui/action@latest
if: env.AA_TOKEN != null
with:
projectToken: ${{ env.AA_TOKEN }}
storybookBuildDir: storybook-dist/angular-accelerator
skip: 'dependabot/**'

11 changes: 6 additions & 5 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ on:
push:
branches:
- '**'
pull_request_target:
branches:
- 'main'
jobs:
deploy-storybooks:
runs-on: ubuntu-latest
environment: Storybook
env:
PIA_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN_PIA }}
AA_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN_AA }}
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -21,14 +22,14 @@ jobs:
- name: Publish to PIA Chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_PIA }}
projectToken: ${{ env.PIA_TOKEN }}
storybookBuildDir: dist/storybook/portal-integration-angular
skip: 'dependabot/**'
- name: Build AA Storybook
run: npx nx run angular-accelerator:build-storybook
- name: Publish to AA Chromatic
uses: chromaui/action@latest
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN_AA }}
projectToken: ${{ env.AA_TOKEN }}
storybookBuildDir: dist/storybook/angular-accelerator
skip: 'dependabot/**'
Loading