From e7527646925e7b054945501bc2c0938a92d3e9ba Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 19 Oct 2026 17:41:10 -0400 Subject: [PATCH] Deploy docs from the prod environment Environment secrets are only exposed to jobs that declare the environment. Split deploy into its own push-only job on 'prod' so PR builds never see the secrets or create deployments. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docs.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4f55b81..b9a3753 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ concurrency: cancel-in-progress: true jobs: - build-and-deploy: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -41,11 +41,33 @@ jobs: env: ASTRO_TELEMETRY_DISABLED: 1 - - name: Deploy to Cloudflare - # Needs repo secrets CLOUDFLARE_API_TOKEN (Edit Cloudflare Workers - # template, scoped to this account and the dev-parikh.com zone) and - # CLOUDFLARE_ACCOUNT_ID + - uses: actions/upload-artifact@v4 if: github.event_name == 'push' + with: + name: docs-dist + path: packages/docs/dist + + deploy: + # Separate job so only pushes to main enter the prod environment — + # PR builds never see its secrets or create deployments + if: github.event_name == 'push' + needs: build + runs-on: ubuntu-latest + environment: + name: prod + url: https://docs.paywright.dev-parikh.com + steps: + - uses: actions/checkout@v5 # for wrangler.jsonc + + - uses: actions/download-artifact@v4 + with: + name: docs-dist + path: packages/docs/dist + + - name: Deploy to Cloudflare + # Needs prod environment secrets CLOUDFLARE_API_TOKEN (Edit Cloudflare + # Workers template, scoped to this account and the dev-parikh.com + # zone) and CLOUDFLARE_ACCOUNT_ID uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}