@@ -3,25 +3,46 @@ name: Deploy
33on :
44 push :
55 branches : [main]
6+ workflow_dispatch :
67
7- jobs :
8- test :
9- uses : ./.github/workflows/ci.yml
8+ concurrency :
9+ group : fly-deploy
10+ cancel-in-progress : false
1011
12+ jobs :
1113 deploy :
12- needs : test
1314 runs-on : ubuntu-latest
1415 steps :
15- - name : Trigger Render deploy
16+ - uses : actions/checkout@v4
17+
18+ - name : Set up Flyctl
19+ uses : superfly/flyctl-actions/setup-flyctl@master
20+
21+ - name : Check FLY_API_TOKEN
1622 env :
17- RENDER_DEPLOY_HOOK_URL : ${{ secrets.RENDER_DEPLOY_HOOK_URL }}
23+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
1824 run : |
19- if [ -z "$RENDER_DEPLOY_HOOK_URL " ]; then
20- echo "::error::RENDER_DEPLOY_HOOK_URL secret is not set." \
21- "Add it under repo Settings > Secrets and variables > Actions " \
22- "(get the URL from the Render service > Settings > Deploy Hook) ."
25+ if [ -z "$FLY_API_TOKEN " ]; then
26+ echo "::error::FLY_API_TOKEN secret is not set." \
27+ "Create a token with 'fly tokens create deploy' (or from the Fly.io dashboard) " \
28+ "and add it under repo Settings > Secrets and variables > Actions ."
2329 exit 1
2430 fi
25- echo "CI passed; triggering Render deploy..."
26- curl -fsS -X POST "$RENDER_DEPLOY_HOOK_URL"
27- echo "Render deploy triggered."
31+
32+ - name : Ensure app and volume exist
33+ env :
34+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
35+ run : |
36+ flyctl apps create climatevision-green || echo "App already exists (or create skipped)."
37+ flyctl volumes create climatevision_data --app climatevision-green \
38+ --region lhr --size 1 --yes || echo "Volume already exists (or create skipped)."
39+
40+ - name : Deploy to Fly.io
41+ env :
42+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
43+ run : fly deploy --remote-only --ha=false
44+
45+ - name : Show status
46+ env :
47+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
48+ run : flyctl status --app climatevision-green
0 commit comments