31
31
uses : bahmutov/npm-install@v1
32
32
33
33
- name : 🏄 Copy test env vars
34
- run : cp .env.example .env
34
+ run : cp .env.example .env
35
35
36
36
- name : 🛠 Setup Database
37
37
run : npx prisma migrate deploy && npx prisma generate --sql
58
58
run : npm run build
59
59
60
60
- name : 🏄 Copy test env vars
61
- run : cp .env.example .env
61
+ run : cp .env.example .env
62
62
63
63
- name : 🛠 Setup Database
64
64
run : npx prisma migrate deploy && npx prisma generate --sql
82
82
uses : bahmutov/npm-install@v1
83
83
84
84
- name : 🏄 Copy test env vars
85
- run : cp .env.example .env
85
+ run : cp .env.example .env
86
86
87
87
- name : 🛠 Setup Database
88
88
run : npx prisma migrate deploy && npx prisma generate --sql
@@ -143,13 +143,57 @@ jobs:
143
143
path : playwright-report/
144
144
retention-days : 30
145
145
146
+ container :
147
+ name : 📦 Prepare Container
148
+ runs-on : ubuntu-24.04
149
+ # only prepare container on pushes
150
+ if : ${{ github.event_name == 'push' }}
151
+ steps :
152
+ - name : ⬇️ Checkout repo
153
+ uses : actions/checkout@v4
154
+ with :
155
+ fetch-depth : 50
156
+
157
+ - name : 👀 Read app name
158
+
159
+ id : app_name
160
+ with :
161
+ file : ' fly.toml'
162
+ field : ' app'
163
+
164
+ - name : 🎈 Setup Fly
165
+ uses :
superfly/flyctl-actions/[email protected]
166
+
167
+ - name : 📦 Build Staging Container
168
+ if : ${{ github.ref == 'refs/heads/dev' }}
169
+ run : |
170
+ flyctl deploy \
171
+ --build-only \
172
+ --push \
173
+ --image-label ${{ github.sha }} \
174
+ --build-arg COMMIT_SHA=${{ github.sha }} \
175
+ --app ${{ steps.app_name.outputs.value }}-staging
176
+ env :
177
+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
178
+
179
+ - name : 📦 Build Production Container
180
+ if : ${{ github.ref == 'refs/heads/main' }}
181
+ run : |
182
+ flyctl deploy \
183
+ --build-only \
184
+ --push \
185
+ --image-label ${{ github.sha }} \
186
+ --build-arg COMMIT_SHA=${{ github.sha }} \
187
+ --app ${{ steps.app_name.outputs.value }}
188
+ env :
189
+ FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
190
+
146
191
deploy :
147
192
name : 🚀 Deploy
148
- runs-on : ubuntu-22 .04
149
- needs : [lint, typecheck, vitest, playwright]
150
- # only build/ deploy branches on pushes
193
+ runs-on : ubuntu-24 .04
194
+ needs : [lint, typecheck, vitest, playwright, container ]
195
+ # only deploy on pushes
151
196
if : ${{ github.event_name == 'push' }}
152
-
153
197
steps :
154
198
- name : ⬇️ Checkout repo
155
199
uses : actions/checkout@v4
@@ -168,16 +212,17 @@ jobs:
168
212
169
213
- name : 🚀 Deploy Staging
170
214
if : ${{ github.ref == 'refs/heads/dev' }}
171
- run :
172
- flyctl deploy --remote-only --build-arg COMMIT_SHA= ${{ github.sha }}
173
- --app ${{ steps.app_name.outputs.value }}-staging
215
+ run : |
216
+ IMAGE="registry.fly.io/${{ steps.app_name.outputs.value }}-staging: ${{ github.sha }}"
217
+ flyctl deploy --image $IMAGE --app ${{ steps.app_name.outputs.value }}-staging
174
218
env :
175
219
FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
176
220
177
221
- name : 🚀 Deploy Production
178
222
if : ${{ github.ref == 'refs/heads/main' }}
179
- run :
180
- flyctl deploy --remote-only --build-arg COMMIT_SHA=${{ github.sha }}
181
- --build-secret SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
223
+ run : |
224
+ IMAGE="registry.fly.io/${{ steps.app_name.outputs.value }}:${{ github.sha }}"
225
+ flyctl deploy --image $IMAGE \
226
+ --build-secret SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
182
227
env :
183
228
FLY_API_TOKEN : ${{ secrets.FLY_API_TOKEN }}
0 commit comments