Skip to content

Commit 6bb2ff5

Browse files
committed
feat: update GitHub Actions workflow for snapshot release with MongoDB 8.0 support and artifact handling
1 parent 0341552 commit 6bb2ff5

File tree

1 file changed

+92
-27
lines changed

1 file changed

+92
-27
lines changed

.github/workflows/branch.yml

Lines changed: 92 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Snapshot release
1+
name: Snapshot Release
22

33
on:
44
push:
@@ -7,66 +7,65 @@ on:
77
tags-ignore:
88
- "*" # Ignore all tags
99
paths:
10-
- "**/*.java" # Trigger on any Java file change
11-
- "**/*.xml" # Trigger on any xml file change
12-
- "**/Dockerfile*" # Trigger on any Dockerfile change
13-
- ".github/workflows/*.yml" # Trigger on any workflow file change
10+
- "**/*.java"
11+
- "**/*.xml"
12+
- "**/Dockerfile*"
13+
- "**/pom.xml"
14+
- ".github/workflows/*.yml"
1415

1516
jobs:
16-
# Build and test the project
1717
build:
1818
if: "!contains(github.event.head_commit.message, 'skip ci')"
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
mongodb-version: ["5.0", "6.0", "7.0"]
22+
mongodb-version: ["5.0", "6.0", "7.0", "8.0"]
2323
timeout-minutes: 5
2424
steps:
2525
- uses: actions/checkout@v4
26-
2726
- name: Set up JDK 21
2827
uses: actions/setup-java@v4
2928
with:
3029
distribution: "temurin"
3130
java-version: "21"
3231
cache: "maven"
33-
3432
- name: Build and Test
3533
env:
3634
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
3735
run: mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"
36+
- name: Upload build artifacts for Docker jobs (only for 8.0)
37+
if: matrix.mongodb-version == '8.0'
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: restheart-artifacts
41+
path: |
42+
core/target/restheart.jar
43+
core/target/lib/*.jar
44+
core/target/plugins/*.jar
45+
core/target/plugins/lib/*.jar
3846
39-
# Deploy the project to Maven Central and DockerHub
40-
deploy:
47+
deploy-maven-central:
4148
if: "!contains(github.event.head_commit.message, 'skip ci')"
49+
needs: build
4250
runs-on: ubuntu-latest
4351
strategy:
4452
matrix:
4553
mongodb-version: ["8.0"]
46-
timeout-minutes: 15
4754
steps:
4855
- uses: actions/checkout@v4
49-
5056
- name: Set up JDK 21
5157
uses: actions/setup-java@v4
5258
with:
5359
distribution: "temurin"
5460
java-version: "21"
5561
cache: "maven"
56-
57-
- name: Set SHA
58-
id: vars
59-
run: |
60-
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
61-
6262
- name: Import private gpg key
6363
run: |
6464
printf "%s" "$GPG_PRIVATE_KEY" > private.key
6565
gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
6666
env:
6767
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
68-
69-
- name: Deploy to Maven Central
68+
- name: Deploy to Maven Central (8.0 only)
7069
run: |
7170
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" \
7271
mvn -B deploy -Pdeploy -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
@@ -76,19 +75,33 @@ jobs:
7675
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
7776
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
7877

78+
build-docker-standard:
79+
if: "!contains(github.event.head_commit.message, 'skip ci')"
80+
needs: build
81+
runs-on: ubuntu-latest
82+
strategy:
83+
matrix:
84+
mongodb-version: ["8.0"]
85+
steps:
86+
- uses: actions/checkout@v4
87+
- name: Download build artifacts
88+
uses: actions/download-artifact@v4
89+
with:
90+
name: restheart-artifacts
91+
path: core/target/
92+
- name: Set SHA
93+
run: |
94+
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
7995
- name: Set up QEMU
8096
uses: docker/setup-qemu-action@v3
81-
8297
- name: Set up Docker Buildx
8398
uses: docker/setup-buildx-action@v3
84-
8599
- name: Login to DockerHub
86100
uses: docker/login-action@v3
87101
with:
88102
username: ${{ secrets.DOCKER_USER }}
89103
password: ${{ secrets.DOCKER_TOKEN }}
90-
91-
- name: Build and Push multi-arch Docker images
104+
- name: Build and Push multi-arch Docker images (8.0 only)
92105
uses: docker/build-push-action@v6
93106
with:
94107
context: ./core/
@@ -104,7 +117,33 @@ jobs:
104117
softinstigate/restheart-snapshot:${{ env.SHA }},
105118
${{ github.ref == 'refs/heads/master' && 'softinstigate/restheart-snapshot:latest' || '' }}
106119
107-
- name: Build and Push GraalVM Docker image
120+
build-docker-graalvm:
121+
if: "!contains(github.event.head_commit.message, 'skip ci')"
122+
needs: build
123+
runs-on: ubuntu-latest
124+
strategy:
125+
matrix:
126+
mongodb-version: ["8.0"]
127+
steps:
128+
- uses: actions/checkout@v4
129+
- name: Download build artifacts
130+
uses: actions/download-artifact@v4
131+
with:
132+
name: restheart-artifacts
133+
path: core/target/
134+
- name: Set SHA
135+
run: |
136+
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
137+
- name: Set up QEMU
138+
uses: docker/setup-qemu-action@v3
139+
- name: Set up Docker Buildx
140+
uses: docker/setup-buildx-action@v3
141+
- name: Login to DockerHub
142+
uses: docker/login-action@v3
143+
with:
144+
username: ${{ secrets.DOCKER_USER }}
145+
password: ${{ secrets.DOCKER_TOKEN }}
146+
- name: Build and Push GraalVM Docker image (8.0 only)
108147
uses: docker/build-push-action@v6
109148
with:
110149
context: ./core/
@@ -119,7 +158,33 @@ jobs:
119158
softinstigate/restheart-snapshot:${{ env.SHA }}-graalvm,
120159
${{ github.ref == 'refs/heads/master' && 'softinstigate/restheart-snapshot:latest-graalvm' || '' }}
121160
122-
- name: Build and Push distroless docker image
161+
build-docker-distroless:
162+
if: "!contains(github.event.head_commit.message, 'skip ci')"
163+
needs: build
164+
runs-on: ubuntu-latest
165+
strategy:
166+
matrix:
167+
mongodb-version: ["8.0"]
168+
steps:
169+
- uses: actions/checkout@v4
170+
- name: Download build artifacts
171+
uses: actions/download-artifact@v4
172+
with:
173+
name: restheart-artifacts
174+
path: core/target/
175+
- name: Set SHA
176+
run: |
177+
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
178+
- name: Set up QEMU
179+
uses: docker/setup-qemu-action@v3
180+
- name: Set up Docker Buildx
181+
uses: docker/setup-buildx-action@v3
182+
- name: Login to DockerHub
183+
uses: docker/login-action@v3
184+
with:
185+
username: ${{ secrets.DOCKER_USER }}
186+
password: ${{ secrets.DOCKER_TOKEN }}
187+
- name: Build and Push distroless docker image (8.0 only)
123188
uses: docker/build-push-action@v6
124189
with:
125190
context: ./core/

0 commit comments

Comments
 (0)