chore(deps-dev): bump the runtime group across 1 directory with 2 updates #810
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: "CI - Website: Validate and Deploy Preview" | |
| on: | |
| workflow_call: | |
| pull_request: | |
| paths: | |
| - website/** | |
| - .github/workflows/ci-website-preview.yml | |
| - .github/workflows/ci-website-cleanup.yml | |
| - pnpm-lock.yaml | |
| defaults: | |
| run: | |
| working-directory: ./website | |
| env: | |
| CLOUDFLARE_WORKERS_DOMAIN: billy-daly.workers.dev | |
| jobs: | |
| # Install, build, and run checks/tests/audit. All post-build steps are | |
| # sequential but each runs regardless of the previous step's pass/fail so | |
| # lint, test, and audit failures all surface in a single CI run. | |
| validate: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| # Read from the upload step (not the build step) so deploy-preview only | |
| # tries to download when the artifact actually exists. | |
| artifact_ready: ${{ steps.upload-build.outcome == 'success' }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| working-directory: . | |
| run: pnpm install --frozen-lockfile | |
| - name: Build site | |
| id: build | |
| run: pnpm run build | |
| - name: Upload build output | |
| # Path-structure invariant: every entry must stay under `website/` so | |
| # upload-artifact strips that common prefix and the deploy-preview | |
| # download (path: website) restores them at website/dist, etc. Adding | |
| # a path outside website/ shrinks the prefix and silently shifts | |
| # download locations. | |
| id: upload-build | |
| if: always() && steps.build.outcome == 'success' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: website-build | |
| path: | | |
| website/dist | |
| website/tsp-output | |
| website/.extension-schemas | |
| website/cache | |
| website/public/schemas/yaml | |
| website/public/openapi | |
| retention-days: 1 | |
| if-no-files-found: error | |
| - name: Run all checks | |
| if: ${{ !cancelled() && steps.build.outcome == 'success' }} | |
| run: pnpm run checks | |
| - name: Run tests | |
| if: ${{ !cancelled() && steps.build.outcome == 'success' }} | |
| run: pnpm run test | |
| - name: Audit dependencies | |
| if: ${{ !cancelled() && steps.build.outcome == 'success' }} | |
| run: pnpm run audit:high | |
| # Deploy the built artifact to a per-PR Cloudflare Worker. Decoupled from | |
| # the test/check/audit outcome (via artifact_ready) so previews stay | |
| # available for reviewing UI changes on PRs that have unrelated failures. | |
| deploy-preview: | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| # !cancelled() (not always()) so a user-cancelled run skips the deploy. | |
| # Dependabot and workflow_call skipped: no PR number to name the worker. | |
| if: | | |
| !cancelled() | |
| && needs.validate.outputs.artifact_ready == 'true' | |
| && github.event_name == 'pull_request' | |
| && github.actor != 'dependabot[bot]' | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "pnpm" | |
| - name: Download build output | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: website-build | |
| path: website | |
| - name: Deploy PR preview | |
| # pnpm dlx fetches wrangler on demand — avoids a full workspace install | |
| # just to get wrangler on PATH. Pin to major @4 to match the devDep in | |
| # website/package.json and avoid silent v5+ drift. | |
| # --allow-build list: wrangler pulls in workerd/esbuild/sharp, each of | |
| # which wants to run a postinstall build; pnpm's default rejects those | |
| # unless explicitly allowed. | |
| run: pnpm --allow-build=workerd --allow-build=esbuild --allow-build=sharp dlx wrangler@4 deploy --name cg-pr-${{ github.event.pull_request.number }} | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Find existing comment | |
| id: find-comment | |
| uses: peter-evans/find-comment@v4 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: "github-actions[bot]" | |
| body-includes: Website Preview Deployed | |
| - name: Post preview link comment | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| 🚀 **Website Preview Deployed!** | |
| Preview your changes at: https://cg-pr-${{ github.event.pull_request.number }}.${{ env.CLOUDFLARE_WORKERS_DOMAIN }} | |
| This preview will be automatically deleted when the PR is closed. | |
| edit-mode: replace |