-
Notifications
You must be signed in to change notification settings - Fork 212
54 lines (46 loc) · 1.68 KB
/
Copy pathdeploy.yml
File metadata and controls
54 lines (46 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: fly-deploy
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Check FLY_API_TOKEN
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: |
if [ -z "$FLY_API_TOKEN" ]; then
echo "::error::FLY_API_TOKEN secret is not set." \
"Create a token with 'fly tokens create deploy' (or from the Fly.io dashboard)" \
"and add it under repo Settings > Secrets and variables > Actions."
exit 1
fi
- name: Ensure app and volume exist
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: |
flyctl apps create climatevision-green || echo "App already exists (or create skipped)."
if ! flyctl volumes list --app climatevision-green | grep -q climatevision_data; then
flyctl volumes create climatevision_data --app climatevision-green --region lhr --size 1 --yes
else
echo "Volume already exists."
fi
- name: Deploy to Fly.io
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
VITE_GOOGLE_MAPS_API_KEY: ${{ secrets.VITE_GOOGLE_MAPS_API_KEY }}
run: >-
flyctl deploy --remote-only --ha=false --wait-timeout 600
--build-arg VITE_GOOGLE_MAPS_API_KEY="$VITE_GOOGLE_MAPS_API_KEY"
- name: Show status
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: flyctl status --app climatevision-green