-
Notifications
You must be signed in to change notification settings - Fork 8.8k
61 lines (58 loc) · 2.8 KB
/
publish-docker.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
name: "Publish Docker Image"
on:
push:
branches: [ snapshot, "*.*.*" ]
#tags: [ "*" ]
#This schedule only takes effect in the default branch
schedule:
- cron: '0 16 * * *' #GMT+0
jobs:
# job 1
publish-images-to-dockerhub:
name: "Publish images to DockerHub"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 17, 21 ]
steps:
# step 1
- name: "Checkout"
uses: actions/checkout@v3
# step 2
- name: "Setup Java JDK"
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
# step 3
- name: "Print maven version"
run: ./mvnw -version
# step 4 based on java8
- name: "Publish images to DockerHub based on java8"
if: matrix.java == 8
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USER }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
if [ "${{ github.ref_name }}" == "develop" ] || [ "${{ github.ref_name }}" == "snapshot" || [ "${{ github.ref_name }}" == "2.x" ]; then
./mvnw -T 4C clean package -Dimage.name=eclipse-temurin:8u422-b05-jdk -Pimage -DskipTests -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw -T 4C clean package -Dimage.name=eclipse-temurin:8u422-b05-jdk -Pimage,release-image-based-on-java8 -DskipTests -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
# step 4 based on java17
- name: "Publish images to DockerHub based on java17"
if: ${{ matrix.java == 17 && github.ref_name != 'develop' && github.ref_name != 'snapshot' && github.ref_name != '2.x' }}
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USER }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
./mvnw -T 4C clean package -Dimage.name=eclipse-temurin:17.0.12_7-jdk -Pimage,release-image-based-on-java17 -DskipTests -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
# step 5 based on java21
- name: "Publish images to DockerHub based on java21"
if: ${{ matrix.java == 21 && github.ref_name != 'develop' && github.ref_name != 'snapshot' && github.ref_name != '2.x' }}
env:
REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USER }}
REGISTRY_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
./mvnw -T 4C clean package -Dimage.name=eclipse-temurin:21.0.4_7-jdk -Pimage,release-image-based-on-java21 -DskipTests -e -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;