name: Apex + preview worker deploy on: push: branches: [rolling] paths: ["workers/**"] pull_request: paths: ["workers/**"] workflow_dispatch: {} concurrency: # PR runs group per PR number (not head ref โ€” same-named branches from # different forks would otherwise share a group) so pushes to the same PR # queue/cancel independently of the rolling deploy group. group: apex-deploy-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }} # false (not true): a mid-job cancel can leave the apex/preview worker pair # half-updated; queuing subsequent runs is safe. cancel-in-progress: false permissions: contents: read jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 22 } - run: >- cd workers && npm ci && npx vitest run --reporter=default --reporter=junit --outputFile=test-results/junit-apex-deploy-test-vitest-s0.xml - name: Upload test results to Codecov if: >- ${{ !cancelled() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && github.actor != 'dependabot[bot]' }} uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5 timeout-minutes: 5 continue-on-error: true with: report_type: test_results files: workers/test-results/junit-apex-deploy-test-vitest-s0.xml disable_search: true fail_ci_if_error: false flags: unit-vitest-s0 name: unit-vitest-s0 version: v11.3.1 deploy-canary: needs: test if: github.event_name != 'pull_request' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 22 } - name: Preflight โ€” every service-binding target must already exist (Task 1.8) env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN_DOCS }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} run: | set -eu cd workers && npm ci missing=0 for w in vyos-docs-rolling-en vyos-docs-v15-en vyos-docs-v14-en vyos-docs-legacy; do for suffix in "" "-candidate"; do npx wrangler deployments list --name "$w$suffix" --json >/dev/null 2>&1 \ || { echo "::error::binding target $w$suffix does not exist โ€” run workers/bootstrap.sh first (Task 1.8)"; missing=1; } done done exit $missing - name: Deploy apex (canary) + preview env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN_DOCS }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} run: | cd workers && npm ci npx wrangler deploy --config apex/wrangler.jsonc --env canary \ --var APEX_BUILD_SHA:'${{ github.sha }}' npx wrangler deploy --config preview/wrangler.jsonc deploy-production: needs: deploy-canary if: github.event_name != 'pull_request' runs-on: ubuntu-latest environment: docs-production # requires reviewer approval (ยง7.2) steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 22 } - name: Deploy apex (production) env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN_DOCS }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} run: | cd workers && npm ci npx wrangler deploy --config apex/wrangler.jsonc --env production \ --var APEX_BUILD_SHA:'${{ github.sha }}'