-
Notifications
You must be signed in to change notification settings - Fork 4
65 lines (64 loc) · 1.96 KB
/
build.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
name: publish-docker
on:
push:
tags:
- 'v*'
jobs:
dist-jar:
name: "Build dist jar"
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- name: "Cache Maven Repos"
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: "Set up JDK 17"
uses: actions/setup-java@v3
with:
java-version: 17
distribution: "temurin"
architecture: x64
- name: "Build distribution tar"
run: |
mvn clean package -B -Dmaven.test.skip -Dcheckstyle.skip -Pprod
- uses: actions/upload-artifact@v3
name: "Upload distribution tar"
with:
name: dist
path: dist
docker-images:
name: "Docker images"
needs: [ dist-jar ]
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
name: "Download distribution tar"
with:
name: dist
path: dist
- name: "Set environment variables"
run: |
echo "DOCKER_REGISTRY=docker.io" >> $GITHUB_ENV
echo "DOCKER_USERNAME=${{ secrets.DOCKERHUB_USER }}" >> $GITHUB_ENV
echo "DOCKER_PASSWORD=${{ secrets.DOCKERHUB_TOKEN }}" >> $GITHUB_ENV
echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV
- name: "Log in to the Container registry"
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v2
- name: "Build and save docker images"
env:
BASE_IMAGE: eclipse-temurin:17-jre-alpine
run: |
make docker.push || make docker.push