Skip to content

Commit ba2c2e3

Browse files
committed
deploy: staging-first — main uploads a staging version, production deploys only on v* tags
Pushing to main must never claim api.interscript.org. Production flips exclusively via a tagged release, behind the production environment gate. AWS Lambda remains the live fallback until the explicit cutover tag.
1 parent 63cf1f3 commit ba2c2e3

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,31 @@ on:
66
tags: ["v*"]
77

88
jobs:
9-
deploy:
9+
deploy-staging:
10+
if: github.ref == 'refs/heads/main'
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v4
1314
- uses: actions/setup-node@v4
1415
with: { node-version: "22" }
1516
- run: npm install
16-
- name: Deploy (staging on main, production on tags)
17-
run: npx wrangler deploy
17+
# Staging only: the workers.dev preview URL, never the production
18+
# route. Production flips exclusively via a v* tag.
19+
- run: npx wrangler versions upload --name interscript-api-staging
20+
env:
21+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
22+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
23+
24+
deploy-production:
25+
if: startsWith(github.ref, 'refs/tags/v')
26+
runs-on: ubuntu-latest
27+
environment: production
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
31+
with: { node-version: "22" }
32+
- run: npm install
33+
- run: npx wrangler deploy
1834
env:
1935
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
2036
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

0 commit comments

Comments
 (0)