diff --git a/.github/workflows/vercel-alias-pagent.yml b/.github/workflows/vercel-alias-pagent.yml deleted file mode 100644 index 6e2dbf9..0000000 --- a/.github/workflows/vercel-alias-pagent.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Pin pagent.link to latest production - -# Re-alias pagent.link to whichever pagent project deployment Vercel -# has just promoted to production. Required because the bare pagent.link -# domain is owned by another team's project at the project-domain layer -# (Vercel rejects adding it as our project's auto-tracking domain), so we -# can serve from it via deployment aliases but it does NOT auto-update on -# new prod deploys. This workflow does the re-alias for us. -# -# Setup: add a VERCEL_TOKEN secret with team-scope access to the ful team. -# Without the secret, the workflow no-ops loudly (does not fail). - -on: - push: - branches: [main] - workflow_dispatch: - -concurrency: - group: vercel-alias-pagent - cancel-in-progress: false - -jobs: - alias: - runs-on: ubuntu-latest - timeout-minutes: 10 - permissions: - contents: read - env: - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} - VERCEL_PROJECT_ID: prj_JhOxWsbBLRb1Sdo19Thbz4eHOyj7 - VERCEL_TEAM_ID: team_zDJQ6yrYdOu79gJBmUIBVYCV - ALIAS: pagent.link - steps: - - name: Skip if VERCEL_TOKEN is unset - id: gate - run: | - if [ -z "$VERCEL_TOKEN" ]; then - echo "::warning::VERCEL_TOKEN secret is unset — skipping auto-alias. Add it under Settings → Secrets → Actions to enable." - echo "skip=true" >> "$GITHUB_OUTPUT" - else - echo "skip=false" >> "$GITHUB_OUTPUT" - fi - - - name: Wait for the production deployment to be READY - if: steps.gate.outputs.skip == 'false' - id: wait - run: | - for i in $(seq 1 30); do - JSON=$(curl -s -H "Authorization: Bearer $VERCEL_TOKEN" \ - "https://api.vercel.com/v6/deployments?projectId=$VERCEL_PROJECT_ID&teamId=$VERCEL_TEAM_ID&target=production&limit=1") - STATE=$(echo "$JSON" | jq -r '.deployments[0].state // "unknown"') - URL=$(echo "$JSON" | jq -r '.deployments[0].url // ""') - echo "attempt $i: state=$STATE url=$URL" - if [ "$STATE" = "READY" ] && [ -n "$URL" ]; then - echo "url=$URL" >> "$GITHUB_OUTPUT" - exit 0 - fi - if [ "$STATE" = "ERROR" ] || [ "$STATE" = "CANCELED" ]; then - echo "::error::Latest production deployment is $STATE — nothing to alias." - exit 1 - fi - sleep 10 - done - echo "::error::Timed out waiting for production deployment to be READY." - exit 1 - - - name: Install Vercel CLI - if: steps.gate.outputs.skip == 'false' - run: npm install -g vercel@latest - - - name: Re-alias $ALIAS to ${{ steps.wait.outputs.url }} - if: steps.gate.outputs.skip == 'false' - run: | - vercel alias set "${{ steps.wait.outputs.url }}" "$ALIAS" \ - --token "$VERCEL_TOKEN" --scope "$VERCEL_TEAM_ID"