Merge pull request #880 from IQSS/877-spa-runtime-config #2385
This file contains hidden or 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: 'Chromatic' | |
| # Event for the workflow | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - develop | |
| # List of jobs | |
| jobs: | |
| chromatic-deployment: | |
| # Operating System | |
| runs-on: ubuntu-latest | |
| # Job steps | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Ensure correct ref on PRs for proper baseline detection | |
| ref: ${{ github.event.pull_request.head.ref || github.ref }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Create .npmrc | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| cp .npmrc.example .npmrc | |
| sed -i -e "s#<YOUR_GITHUB_AUTH_TOKEN>#${GITHUB_TOKEN}#g" .npmrc | |
| # Comment out npmjs auth token line if no token provided via secrets | |
| sed -i -e 's#//registry.npmjs.org/:_authToken=<YOUR_NPM_AUTH_TOKEN>#; auth token omitted in CI#g' .npmrc | |
| - name: Install dependencies | |
| # 👇 Use clean install for reproducible CI installs | |
| run: npm ci | |
| # 👇 Adds Chromatic as a step in the workflow | |
| # Install design system dependencies | |
| - name: Build Dataverse Design System | |
| working-directory: packages/design-system | |
| run: npm run build | |
| - name: Publish to Chromatic | |
| uses: chromaui/action@latest | |
| env: | |
| STORYBOOK_CHROMATIC_BUILD: 'true' | |
| # Provide PR metadata to Chromatic for correct git/baseline context | |
| CHROMATIC_BRANCH: ${{ github.event.pull_request.head.ref || github.ref_name }} | |
| CHROMATIC_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |
| CHROMATIC_SLUG: ${{ github.repository }} | |
| # Chromatic GitHub Action options | |
| with: | |
| # 👇 Chromatic projectToken, refer to the manage page to obtain it. | |
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} |