-
-
Notifications
You must be signed in to change notification settings - Fork 170
141 lines (126 loc) · 4.62 KB
/
branch.yml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build snapshot release
on:
push:
branches:
- "*" # All branches for snapshot builds
tags-ignore:
- "*" # Ignore all tags
jobs:
# Build and test the project
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-22.04
strategy:
matrix:
mongodb-version: ["5.0", "6.0"]
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Build and Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
run: mvn -B clean verify -Dmongodb.version="${{ matrix.mongodb-version }}"
# Deploy the project to Maven Central and DockerHub
deploy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-22.04
strategy:
matrix:
mongodb-version: ["7.0"]
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Set SHA
id: vars
run: |
echo "SHA=$(echo ${GITHUB_SHA:0:7})" >> $GITHUB_ENV
- name: Import private gpg key
run: |
printf "%s" "$GPG_PRIVATE_KEY" > private.key
gpg --pinentry-mode=loopback --batch --yes --fast-import private.key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Deploy to Maven Central
run: |
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" \
mvn -B deploy -Pdeploy -Dmongodb.version="${{ matrix.mongodb-version }}" -s settings.xml
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and Push multi-arch Docker images
uses: docker/build-push-action@v6
with:
context: ./core/
platforms: |
linux/amd64,
linux/arm64,
linux/ppc64le,
linux/s390x
push: true # push all images built
pull: true # pull all required images before building
# NOTE: snapshot images must be tagged with "latest" in master branch only
tags: |
softinstigate/restheart-snapshot:latest,
softinstigate/restheart-snapshot:${{ env.SHA }}
- name: Build and Push GraalVM Docker image
uses: docker/build-push-action@v6
with:
context: ./core/
file: ./core/Dockerfile.graalvm
platforms: |
linux/amd64,
linux/arm64
push: true # push all images built
pull: true # pull all required images before building
# NOTE: snapshot images must be tagged with "graalvm" in master branch only
tags: |
softinstigate/restheart-snapshot:graalvm,
softinstigate/restheart-snapshot:${{ env.SHA }}-graalvm
- name: Build and Push distroless docker image
uses: docker/build-push-action@v6
with:
context: ./core/
file: ./core/Dockerfile.distroless
platforms: |
linux/amd64,
linux/arm64,
linux/ppc64le
push: true # push all images built
pull: true # pull all required images before building
# NOTE: snapshot images must be tagged with "distroless" in master branch only
tags: |
softinstigate/restheart-snapshot:distroless,
softinstigate/restheart-snapshot:${{ env.SHA }}-distroless