CI - Github Actions #18
Workflow file for this run
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: Storybook - Lint, Build and Deploy | |
on: | |
pull_request: | |
paths: | |
- 'storybook/**' | |
- '!examples/**' | |
- '!packages/react/**' | |
- '!packages/sdk/**' | |
- '!packages/ui/**' | |
jobs: | |
storybook: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: storybook/ | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
# TODO: Remove right before merge. | |
with: | |
ref: 'feature/github-actions' | |
- name: Setup Node version | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b | |
with: | |
node-version-file: '.nvmrc' # Root of the repository. | |
# TODO: NPM login instead of auth token? | |
- name: Authenticate with private NPM package | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
- name: Lint check | |
run: npm run lint | |
- name: Build | |
run: npm run build-storybook | |
deploy: | |
needs: storybook | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: storybook/ | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment. | |
permissions: | |
pages: write | |
id-token: write | |
# Deploy to the github-pages environment. | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# - name: Archive artifact | |
# shell: sh | |
# run: | | |
# echo ::group::Archive artifact | |
# tar \ | |
# --dereference --hard-dereference \ | |
# --directory "storybook-static/" \ | |
# -cvf "$RUNNER_TEMP/artifact.tar" \ | |
# --exclude=.git \ | |
# --exclude=.github \ | |
# . | |
# echo ::endgroup:: | |
- name: Upload artifact | |
id: upload-artifact | |
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b | |
with: | |
name: storybook | |
path: storybook-static | |
retention-days: 90 | |
if-no-files-found: error | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e |