build: add workflow to sync Canon storybook build to canon-storybook repo

Signed-off-by: MT Lewis <mtlewis@users.noreply.github.com>
This commit is contained in:
MT Lewis
2024-11-27 17:28:28 +00:00
parent 96c4e26961
commit 8ca4dacd59
+56
View File
@@ -0,0 +1,56 @@
name: Sync Canon Storybook
on:
push:
branches: [master]
jobs:
sync-canon-storybook:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Use Node.js 20.x
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install
uses: backstage/actions/yarn-install@25145dd4117d50e1da9330e9ed2893bc6b75373e # v0.6.15
with:
cache-prefix: ${{ runner.os }}-v20.x
- name: Checkout backstage/canon-storybook
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: backstage/canon-storybook
path: canon-storybook
token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
- name: Configure Git
run: |
git config --global user.email noreply@backstage.io
git config --global user.name 'Github Canon Storybook workflow'
- name: Build Canon Storybook
run: |
yarn workspace @backstage/canon run build-storybook
- name: Replace contents of canon-storybook repo with Storybook build output
working-directory: canon-storybook
run: |
git rm -rf .
cp -R ../packages/canon/storybook-static/. .
- name: Commit to canon-storybook repo
working-directory: canon-storybook
run: |
git add .
git commit -am "Canon Storybook build for backstage/backstage@${{ github.sha }}"
git push