-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (50 loc) · 1.71 KB
/
java-ci.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: Java CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
publish:
if: ${{ github.event_name != 'pull_request' && github.ref_name == 'master' }}
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build Spring Boot Image
run: mvn -B spring-boot:build-image "-Dspring-boot.build-image.imageName=ghcr.io/${{ github.repository }}" --file pom.xml
- name: Get Maven project version
id: version
uses: jactions/[email protected]
- name: Add version tag
run: >-
docker tag ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: >-
docker push ghcr.io/${{ github.repository }}:latest &&
docker push ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}