14
14
runs-on : ubuntu-latest
15
15
strategy :
16
16
matrix :
17
- mongodb-version : ["5.0", "6.0", "7.0"]
17
+ mongodb-version : ["5.0", "6.0", "7.0", "8.0" ]
18
18
timeout-minutes : 10
19
19
steps :
20
20
- uses : actions/checkout@v4
30
30
run : |
31
31
mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"
32
32
33
- # Deploy the project to Maven Central and DockerHub
34
- deploy :
33
+ - name : Upload build artifacts for Docker jobs
34
+ if : matrix.mongodb-version == '8.0'
35
+ uses : actions/upload-artifact@v4
36
+ with :
37
+ name : restheart-artifacts
38
+ path : |
39
+ core/target/restheart.jar
40
+ core/target/lib/*.jar
41
+ core/target/plugins/*.jar
42
+ core/target/plugins/lib/*.jar
43
+
44
+ # Release the project on GitHub
45
+ release :
35
46
if : " !contains(github.event.head_commit.message, 'skip ci')"
47
+ needs : build
36
48
runs-on : ubuntu-latest
37
49
outputs :
38
50
version : ${{ steps.set_version.outputs.version }}
@@ -53,44 +65,13 @@ jobs:
53
65
- name : Build and Test
54
66
run : mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"
55
67
56
- - name : Import private gpg key
57
- run : |
58
- printf "%s" "$GPG_PRIVATE_KEY" > private.key
59
- gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
60
- continue-on-error : true
61
- env :
62
- GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
63
-
64
- - name : Deploy to Maven Central
65
- continue-on-error : true
66
- run : |
67
- MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" \
68
- mvn -B deploy -Pdeploy -DskipTests -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
69
- env :
70
- CENTRAL_USERNAME : ${{ secrets.CENTRAL_USERNAME }}
71
- CENTRAL_PASSWORD : ${{ secrets.CENTRAL_PASSWORD }}
72
- GPG_KEY_NAME : ${{ secrets.GPG_KEY_NAME }}
73
- GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
74
-
75
- - name : Set up QEMU
76
- uses : docker/setup-qemu-action@v3
77
-
78
- - name : Set up Docker Buildx
79
- uses : docker/setup-buildx-action@v3
80
-
81
- - name : Login to DockerHub
82
- uses : docker/login-action@v3
83
- with :
84
- username : ${{ secrets.DOCKER_USER }}
85
- password : ${{ secrets.DOCKER_TOKEN }}
86
-
87
68
- name : Set VERSION
88
69
id : set_version
89
70
run : |
90
71
VERSION=${GITHUB_REF#refs/tags/}
91
72
echo "VERSION=$VERSION" >> $GITHUB_ENV
92
73
echo "version=$VERSION" >> $GITHUB_OUTPUT
93
-
74
+
94
75
- name : Extract Version Components
95
76
id : extract_version
96
77
run : |
@@ -103,13 +84,60 @@ jobs:
103
84
echo "MINOR=$MINOR" >> $GITHUB_ENV
104
85
echo "PATCH=$PATCH" >> $GITHUB_ENV
105
86
87
+ - name : Upload GitHub release
88
+ uses : softprops/action-gh-release@v2
89
+ env :
90
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
91
+ with :
92
+ body : |
93
+ # Release ${{ env.VERSION }}
94
+ files : |
95
+ core/target/restheart.tar.gz
96
+ core/target/restheart.zip
97
+ draft : true
98
+ prerelease : false
99
+
100
+ build-docker-standard :
101
+ if : " !contains(github.event.head_commit.message, 'skip ci')"
102
+ needs : build
103
+ runs-on : ubuntu-latest
104
+ strategy :
105
+ matrix :
106
+ mongodb-version : ["8.0"]
107
+ timeout-minutes : 10
108
+ steps :
109
+ - uses : actions/checkout@v4
110
+ - name : Download build artifacts
111
+ uses : actions/download-artifact@v4
112
+ with :
113
+ name : restheart-artifacts
114
+ path : core/target/
115
+ - name : Set VERSION
116
+ run : |
117
+ VERSION=${GITHUB_REF#refs/tags/}
118
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
119
+ - name : Extract Version Components
120
+ run : |
121
+ MAJOR=$(echo "$VERSION" | cut -d '.' -f 1)
122
+ MINOR=$(echo "$VERSION" | cut -d '.' -f 2)
123
+ PATCH=$(echo "$VERSION" | cut -d '.' -f 3)
124
+ echo "MAJOR=$MAJOR" >> $GITHUB_ENV
125
+ echo "MINOR=$MINOR" >> $GITHUB_ENV
126
+ echo "PATCH=$PATCH" >> $GITHUB_ENV
106
127
- name : Set Docker Tags for standard images
107
128
id : set_tags
108
129
run : |
109
- # Construct all tags based on the MAJOR.MINOR.PATCH format
110
- TAGS="softinstigate/restheart:latest,softinstigate/restheart:${{ env.MAJOR }},softinstigate/restheart:${{ env.MAJOR }}.${{ env.MINOR }},softinstigate/restheart:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}"
130
+ TAGS="softinstigate/restheart:latest,softinstigate/restheart:$MAJOR,softinstigate/restheart:$MAJOR.$MINOR,softinstigate/restheart:$MAJOR.$MINOR.$PATCH"
111
131
echo "TAGS=$TAGS" >> $GITHUB_ENV
112
-
132
+ - name : Set up QEMU
133
+ uses : docker/setup-qemu-action@v3
134
+ - name : Set up Docker Buildx
135
+ uses : docker/setup-buildx-action@v3
136
+ - name : Login to DockerHub
137
+ uses : docker/login-action@v3
138
+ with :
139
+ username : ${{ secrets.DOCKER_USER }}
140
+ password : ${{ secrets.DOCKER_TOKEN }}
113
141
- name : Build and Push multi-arch Docker images
114
142
uses : docker/build-push-action@v6
115
143
with :
@@ -119,17 +147,51 @@ jobs:
119
147
linux/arm64,
120
148
linux/ppc64le,
121
149
linux/s390x
122
- push : true # push all images built
123
- pull : true # pull all required images before building
150
+ push : true
151
+ pull : true
124
152
tags : ${{ env.TAGS }}
125
153
154
+ build-docker-graalvm :
155
+ if : " !contains(github.event.head_commit.message, 'skip ci')"
156
+ needs : build
157
+ runs-on : ubuntu-latest
158
+ strategy :
159
+ matrix :
160
+ mongodb-version : ["8.0"]
161
+ timeout-minutes : 10
162
+ steps :
163
+ - uses : actions/checkout@v4
164
+ - name : Download build artifacts
165
+ uses : actions/download-artifact@v4
166
+ with :
167
+ name : restheart-artifacts
168
+ path : core/target/
169
+ - name : Set VERSION
170
+ run : |
171
+ VERSION=${GITHUB_REF#refs/tags/}
172
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
173
+ - name : Extract Version Components
174
+ run : |
175
+ MAJOR=$(echo "$VERSION" | cut -d '.' -f 1)
176
+ MINOR=$(echo "$VERSION" | cut -d '.' -f 2)
177
+ PATCH=$(echo "$VERSION" | cut -d '.' -f 3)
178
+ echo "MAJOR=$MAJOR" >> $GITHUB_ENV
179
+ echo "MINOR=$MINOR" >> $GITHUB_ENV
180
+ echo "PATCH=$PATCH" >> $GITHUB_ENV
126
181
- name : Set Docker Tags for GraalVM image
127
182
id : set_graalvm_tags
128
183
run : |
129
- # Construct all tags based on the MAJOR.MINOR.PATCH format
130
- TAGS_GRAALVM="softinstigate/restheart:latest-graalvm,softinstigate/restheart:${{ env.MAJOR }}-graalvm,softinstigate/restheart:${{ env.MAJOR }}.${{ env.MINOR }}-graalvm,softinstigate/restheart:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-graalvm"
184
+ TAGS_GRAALVM="softinstigate/restheart:latest-graalvm,softinstigate/restheart:$MAJOR-graalvm,softinstigate/restheart:$MAJOR.$MINOR-graalvm,softinstigate/restheart:$MAJOR.$MINOR.$PATCH-graalvm"
131
185
echo "TAGS_GRAALVM=$TAGS_GRAALVM" >> $GITHUB_ENV
132
-
186
+ - name : Set up QEMU
187
+ uses : docker/setup-qemu-action@v3
188
+ - name : Set up Docker Buildx
189
+ uses : docker/setup-buildx-action@v3
190
+ - name : Login to DockerHub
191
+ uses : docker/login-action@v3
192
+ with :
193
+ username : ${{ secrets.DOCKER_USER }}
194
+ password : ${{ secrets.DOCKER_TOKEN }}
133
195
- name : Build and Push GraalVM Docker image
134
196
uses : docker/build-push-action@v6
135
197
with :
@@ -138,17 +200,51 @@ jobs:
138
200
platforms : |
139
201
linux/amd64,
140
202
linux/arm64
141
- push : true # push all images built
142
- pull : true # pull all required images before building
203
+ push : true
204
+ pull : true
143
205
tags : ${{ env.TAGS_GRAALVM }}
144
206
207
+ build-docker-distroless :
208
+ if : " !contains(github.event.head_commit.message, 'skip ci')"
209
+ needs : build
210
+ runs-on : ubuntu-latest
211
+ strategy :
212
+ matrix :
213
+ mongodb-version : ["8.0"]
214
+ timeout-minutes : 10
215
+ steps :
216
+ - uses : actions/checkout@v4
217
+ - name : Download build artifacts
218
+ uses : actions/download-artifact@v4
219
+ with :
220
+ name : restheart-artifacts
221
+ path : core/target/
222
+ - name : Set VERSION
223
+ run : |
224
+ VERSION=${GITHUB_REF#refs/tags/}
225
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
226
+ - name : Extract Version Components
227
+ run : |
228
+ MAJOR=$(echo "$VERSION" | cut -d '.' -f 1)
229
+ MINOR=$(echo "$VERSION" | cut -d '.' -f 2)
230
+ PATCH=$(echo "$VERSION" | cut -d '.' -f 3)
231
+ echo "MAJOR=$MAJOR" >> $GITHUB_ENV
232
+ echo "MINOR=$MINOR" >> $GITHUB_ENV
233
+ echo "PATCH=$PATCH" >> $GITHUB_ENV
145
234
- name : Set Docker tags for Distroless image
146
235
id : set_distroless_tags
147
236
run : |
148
- # Construct all tags based on the MAJOR.MINOR.PATCH format
149
- TAGS_DISTROLESS="softinstigate/restheart:latest-distroless,softinstigate/restheart:${{ env.MAJOR }}-distroless,softinstigate/restheart:${{ env.MAJOR }}.${{ env.MINOR }}-distroless,softinstigate/restheart:${{ env.MAJOR }}.${{ env.MINOR }}.${{ env.PATCH }}-distroless"
237
+ TAGS_DISTROLESS="softinstigate/restheart:latest-distroless,softinstigate/restheart:$MAJOR-distroless,softinstigate/restheart:$MAJOR.$MINOR-distroless,softinstigate/restheart:$MAJOR.$MINOR.$PATCH-distroless"
150
238
echo "TAGS_DISTROLESS=$TAGS_DISTROLESS" >> $GITHUB_ENV
151
-
239
+ - name : Set up QEMU
240
+ uses : docker/setup-qemu-action@v3
241
+ - name : Set up Docker Buildx
242
+ uses : docker/setup-buildx-action@v3
243
+ - name : Login to DockerHub
244
+ uses : docker/login-action@v3
245
+ with :
246
+ username : ${{ secrets.DOCKER_USER }}
247
+ password : ${{ secrets.DOCKER_TOKEN }}
152
248
- name : Build and Push distroless docker image
153
249
uses : docker/build-push-action@v6
154
250
with :
@@ -158,28 +254,50 @@ jobs:
158
254
linux/amd64,
159
255
linux/arm64,
160
256
linux/ppc64le
161
- push : true # push all images built
162
- pull : true # pull all required images before building
257
+ push : true
258
+ pull : true
163
259
tags : ${{ env.TAGS_DISTROLESS }}
164
260
165
- - name : Upload GitHub release
166
- uses : softprops/action-gh-release@v2
167
- env :
168
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
261
+ deploy-maven-central :
262
+ if : " !contains(github.event.head_commit.message, 'skip ci')"
263
+ needs : build
264
+ runs-on : ubuntu-latest
265
+ strategy :
266
+ matrix :
267
+ mongodb-version : ["8.0"]
268
+ timeout-minutes : 20
269
+ steps :
270
+ - uses : actions/checkout@v4
271
+
272
+ - name : Set up JDK 21
273
+ uses : actions/setup-java@v4
169
274
with :
170
- body : |
171
- # Release ${{ env.VERSION }}
172
- files : |
173
- core/target/restheart.tar.gz
174
- core/target/restheart.zip
175
- draft : true
176
- prerelease : false
275
+ distribution : " temurin"
276
+ java-version : " 21"
277
+ cache : " maven"
278
+
279
+ - name : Import private gpg key
280
+ run : |
281
+ printf "%s" "$GPG_PRIVATE_KEY" > private.key
282
+ gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
283
+ env :
284
+ GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
285
+
286
+ - name : Deploy to Maven Central
287
+ run : |
288
+ MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" \
289
+ mvn -B deploy -Pdeploy -DskipTests -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
290
+ env :
291
+ CENTRAL_USERNAME : ${{ secrets.CENTRAL_USERNAME }}
292
+ CENTRAL_PASSWORD : ${{ secrets.CENTRAL_PASSWORD }}
293
+ GPG_KEY_NAME : ${{ secrets.GPG_KEY_NAME }}
294
+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
177
295
178
296
# Separate job to call the reusable workflow
179
297
call-native-image-release :
180
298
if : " !contains(github.event.head_commit.message, 'skip ci')"
181
- needs : deploy
299
+ needs : release
182
300
uses : softinstigate/restheart/.github/workflows/native-image-release.yml@master
183
301
secrets : inherit
184
302
with :
185
- version : " ${{ needs.deploy .outputs.version }}"
303
+ version : " ${{ needs.release .outputs.version }}"
0 commit comments