File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Deploy Production
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ deploy :
10+ runs-on : ubuntu-latest
11+ name : Deploy Production
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - uses : pnpm/action-setup@v4
16+ with :
17+ version : 9
18+
19+ - name : Setup Node.js
20+ uses : actions/setup-node@v4
21+ with :
22+ node-version : " 22"
23+ cache : " pnpm"
24+
25+ - name : Install dependencies
26+ run : pnpm install
27+
28+ - name : Deploy to Cloudflare Workers
29+ id : deploy-production
30+ uses : cloudflare/wrangler-action@v3
31+ with :
32+ apiToken : ${{ secrets.CF_API_TOKEN }}
33+ command : deploy
34+
35+ - name : Get deployment URL
36+ id : deployment-url
37+ run : |
38+ PRODUCTION_URL=$(echo '${{ steps.deploy-production.outputs.deployedUrl }}')
39+ if [ -z "$PRODUCTION_URL" ]; then
40+ PRODUCTION_URL="https://github-achievements-api.wangrunlin.workers.dev"
41+ fi
42+ echo "url=$PRODUCTION_URL" >> $GITHUB_OUTPUT
43+
44+ - name : Comment on commit
45+ uses : peter-evans/commit-comment@v2
46+ with :
47+ body : |
48+ 🚀 Production deployment is ready!
49+
50+ 🔗 [Production Link](${{ steps.deployment-url.outputs.url }})
51+
52+ Branch: ${{ github.ref_name }}
53+ Commit: ${{ github.sha }}
Original file line number Diff line number Diff line change 2626 run : pnpm install
2727
2828 - name : Deploy to Cloudflare Workers with Preview
29+ id : deploy-preview
2930 uses : cloudflare/wrangler-action@v3
3031 with :
3132 apiToken : ${{ secrets.CF_API_TOKEN }}
3233 command : deploy --env preview
33- env :
34- CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CF_ACCOUNT_ID }}
34+
35+ - name : Get deployment URL
36+ id : deployment-url
37+ run : |
38+ PREVIEW_URL=$(echo '${{ steps.deploy-preview.outputs.deployedUrl }}')
39+ if [ -z "$PREVIEW_URL" ]; then
40+ PREVIEW_URL="https://github-achievements-api-preview.wangrunlin.workers.dev"
41+ fi
42+ echo "url=$PREVIEW_URL" >> $GITHUB_OUTPUT
43+
44+ - name : Comment on commit
45+ uses : peter-evans/commit-comment@v2
46+ with :
47+ body : |
48+ 🚀 Preview deployment is ready!
49+
50+ 🔗 [Preview Link](${{ steps.deployment-url.outputs.url }})
51+
52+ Branch: ${{ github.ref_name }}
53+ Commit: ${{ github.sha }}
Original file line number Diff line number Diff line change @@ -3,4 +3,5 @@ main = "src/index.ts"
33compatibility_date = " 2025-02-27"
44
55[env .preview ]
6- name = " github-achievements-api-preview"
6+ name = " github-achievements-api-preview"
7+ # Asegúrate de que el entorno de vista previa tenga la misma configuración que el entorno principal
You can’t perform that action at this time.
0 commit comments