-
Notifications
You must be signed in to change notification settings - Fork 9
51 lines (51 loc) · 1.75 KB
/
gradle.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
on: [push, pull_request, create]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
os: [ubuntu-latest] #, windows-latest, macos-latest]
jdk: [8]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.jdk }}
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ matrix.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ matrix.os }}-gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Execute tests
run: ./gradlew check || (exitcode=$?; find build/tests -name '*.log' -type f | while read f; do echo -e "\033[4m$f\033[0m"; cat $f; done && return $exitcode)
- name: Build deployment artifacts
run: ./gradlew deploy
- name: Upload jars as artifact
uses: actions/upload-artifact@v4
with:
name: software-challenge-backend-${{ github.sha }}
path: |
build/deploy/*.zip
build/deploy/*.jar
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4 # https://github.com/actions/download-artifact
with:
name: software-challenge-backend-${{ github.sha }}
path: artifacts
- name: Release ${{ github.ref }}
uses: softprops/action-gh-release@v1 # https://github.com/softprops/action-gh-release
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}