-
Notifications
You must be signed in to change notification settings - Fork 9
69 lines (59 loc) · 2.42 KB
/
Copy pathdeploy.yml
File metadata and controls
69 lines (59 loc) · 2.42 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: deploy
on:
push:
branches: [master]
paths:
- 'server/**'
- 'branding/**'
- 'Dockerfile'
- '.dockerignore'
- '.github/workflows/deploy.yml'
workflow_dispatch:
# Serialize deploys: a second push that lands while one deploy is running waits
# rather than racing for Fly's deploy lock. cancel-in-progress=false → newer run
# queues behind in-flight, doesn't kill it (kills risk leaving the app in a
# half-released state).
concurrency:
group: fly-deploy
cancel-in-progress: false
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# JDK 24 (matches jvmToolchain(24)) for the pre-deploy build & test gate. The native image
# itself is compiled inside the GraalVM container by the Dockerfile — no GraalVM needed here.
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '24'
- uses: gradle/actions/setup-gradle@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
# Don't deploy a broken build. `build` runs `check` which runs `test`. (The Dockerfile build
# only runs nativeCompile, not the test suite, so this is where tests gate the deploy.)
- name: Build & test
working-directory: server
run: ./gradlew build
# Build the GraalVM native image from the Dockerfile and release it. `--local-only` builds on
# this runner's Docker daemon (16 GB RAM) rather than Fly's default remote builder, which is
# memory-starved and OOMs during native-image analysis (~6 GB peak needed). Run from the repo
# root: the Dockerfile's build context needs ../branding, and --config points Fly at
# server/fly.toml. OPENGB_VERSION stamps the build with the commit SHA.
- name: Deploy native image to Fly
run: |
flyctl deploy \
--config server/fly.toml \
--dockerfile Dockerfile \
--local-only \
--build-arg OPENGB_VERSION=${{ github.sha }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
- name: Summarize
if: success()
run: |
echo "### Deployed (GraalVM native image)" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "- Commit: ${{ github.sha }}" >> "$GITHUB_STEP_SUMMARY"
echo "- App: https://fly.io/apps/open-green-button" >> "$GITHUB_STEP_SUMMARY"