Merge remote-tracking branch 'upstream/show-your-work' into show-your… #6
This file contains 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
name: Publish Storybook to GitHub Pages | |
# See: https://www.chromatic.com/docs/setup-turbosnap/#github-pull_request-triggers | |
on: | |
workflow_dispatch: | |
# Other Khan Academy repositories use this trigger for the chromaui/action | |
# and it appears to work-ish, so we'll use the same. If it starts to break, | |
# review the above URL to see how to fix it. | |
pull_request: | |
push: | |
branches: [show-your-work] | |
# When a new revision is pushed to a PR, cancel all in-progress CI runs for that | |
# PR. See https://docs.github.com/en/actions/using-jobs/using-concurrency | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# chromaui/@action doesn't work with shallow checkouts which is the | |
# default for actions/checkout so we need to force it to checkout | |
# more stuff. | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Get yarn cache | |
id: yarn-cache | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.yarn-cache.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Cache node modules | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-node_modules- | |
- name: Install | |
run: yarn install | |
- name: Build Storybook | |
run: yarn build-storybook | |
- name: Upload Page Artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./storybook-static/ | |
deploy: | |
needs: build | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
actions: read # to access artifacts from the build job | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |