generated from creek-service/aggregate-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 2.34 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
66
67
68
69
70
71
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
build:
if: ${{ github.run_number != 1 }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.2.0
- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Build
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: ./gradlew check coveralls
release:
if: github.event_name == 'push'
permissions:
contents: write
packages: write
needs: build
runs-on: ubuntu-latest
concurrency:
group: "${{ github.repository }}-release"
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.2.0
- name: Fetch version history
# Do NOT want to fetch all tags if building a specific tag.
# Doing so could result in code published with wrong version, if newer tags have been pushed
if: (!startsWith(github.ref, 'refs/tags/'))
run: git fetch --tag --unshallow
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Login to GitHub Container Registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Increment patch number
run: |
./gradlew cV
./gradlew release clean
./gradlew cV
- name: Publish jars
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish
- name: Push Docker images
run: ./gradlew pushAppImage