Merge pull request #141 from rangle/next-demo-sst #18
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
# updats the baseline | |
# Workflow name | |
name: main-chromatic | |
# Event for the workflow | |
on: | |
push: | |
branches: | |
- main | |
# List of jobs | |
jobs: | |
chromatic-deployment: | |
# Operating System | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
# Job steps | |
steps: | |
- name: Checkout the codebase | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# For NX caching | |
# For more info see: https://nx.dev/recipes/ci/monorepo-ci-github-actions | |
- uses: nrwl/nx-set-shas@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
# Cache node_modules to speed up future builds | |
# For more info see: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows | |
- name: Cache node modules | |
id: cache-nodemodules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache.name }}-${{ github.head_ref }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache.name }}-${{ github.head_ref }}- | |
${{ runner.os }}-build-${{ env.cache.name }}-main- | |
${{ runner.os }}-build-${{ env.cache.name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
# Only install dependencies if cached dependencies aren't found (applies when content of package-lock.json changes) | |
- name: Install Dependencies | |
if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }} | |
run: npm ci | |
- name: Validate tokens | |
id: validate-tokens | |
run: | | |
# Parse and Validate Design Tokens | |
npm run tokens:ci | |
- name: Build projects 🏗 | |
run: npx nx run next-demo:build --skip-nx-cache | |
# 👇 Adds Chromatic as a step in the workflow | |
- name: Publish to Chromatic | |
uses: chromaui/action@v1 | |
# Chromatic GitHub Action options | |
with: | |
# 👇 Chromatic projectToken, refer to the manage page to obtain it. | |
buildScriptName: build-storybook | |
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
# onlyChanged: true | |
# traceChanged: true | |
id: chromatic |