chore: update github actions #2367
Workflow file for this run
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: Pull Request | |
| on: | |
| pull_request: | |
| paths-ignore: | |
| - '.changeset/**' | |
| - '.husky/**' | |
| concurrency: | |
| group: ci-pull-request=${{github.ref}}-1 | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write # Required for reusable workflow validation (not used by canary job) | |
| issues: write | |
| pull-requests: write | |
| statuses: write | |
| id-token: write # Required for trusted publishing (OIDC) | |
| jobs: | |
| publish-canary: | |
| name: 'Build & canary release' | |
| uses: ./.github/workflows/publish.yml | |
| with: | |
| publish-type: canary | |
| pr-number: ${{ github.event.number }} | |
| secrets: inherit | |
| tests: | |
| name: 'Tests & lint' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Update Corepack | |
| run: npm i -g corepack@latest | |
| - name: Enable Corepack (pre) | |
| run: corepack enable | |
| - name: Prepare pnpm (pre) | |
| run: corepack prepare [email protected] --activate | |
| - uses: actions/cache@v4 | |
| name: Download eslint cache | |
| with: | |
| path: | | |
| **/.eslintcache | |
| key: ${{ runner.os }}-eslint | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Prepare pnpm | |
| run: corepack prepare [email protected] --activate | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Run the lint | |
| run: pnpm lint | |
| - name: Run the tests | |
| run: pnpm test:no-cache | |
| deploy-chromatic: | |
| name: 'Prepare Storybook for review & tests' | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: Chromatic staging | |
| url: ${{ steps.publish_chromatic.outputs.url }} | |
| env: | |
| CHROMATIC_RETRIES: 5 | |
| LOG_LEVEL: 'error' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update Corepack | |
| run: npm i -g corepack@latest | |
| - name: Enable Corepack (pre) | |
| run: corepack enable | |
| - name: Prepare pnpm (pre) | |
| run: corepack prepare [email protected] --activate | |
| - uses: actions/cache@v4 | |
| name: Download storybook cache | |
| with: | |
| path: | | |
| **/node_modules/.cache | |
| key: ${{ runner.os }}-storybook-${{ github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-storybook | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Prepare pnpm | |
| run: corepack prepare [email protected] --activate | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Publish to Chromatic | |
| id: publish_chromatic | |
| uses: chromaui/action@v11 | |
| with: | |
| exitZeroOnChanges: true | |
| exitOnceUploaded: true | |
| onlyChanged: true | |
| debug: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | |
| - name: Comment PR | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const setMessage = require('${{ github.workspace }}/scripts/ci/set-message.cjs') | |
| await setMessage({ | |
| header: "## 🧪 Storybook is successfully deployed!", | |
| body: ` | |
| - 👀 Review changes: ${{ steps.publish_chromatic.outputs.url }} | |
| - 👨🎨 Preview storybook: ${{ steps.publish_chromatic.outputs.storybookUrl }} | |
| `, | |
| github, | |
| repo: context.repo, | |
| prNumber: context.payload.pull_request.number | |
| }) |