-
-
Notifications
You must be signed in to change notification settings - Fork 1
66 lines (55 loc) · 1.92 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Java CI with Gradle
on:
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: "${{ github.workflow }}-${{ github.event.number || github.ref }}"
cancel-in-progress: true
permissions:
actions: write
contents: read
jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
strategy:
matrix:
java: ["17"]
os: ["ubuntu-latest"]
fail-fast: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@main
- name: Build with Gradle
uses: gradle/gradle-build-action@main
with:
cache-read-only: ${{ !startsWith(github.ref, 'refs/heads/master/') || github.event_name == 'pull_request' }}
arguments: "build --stacktrace"
- name: Determine status & prepare for publish
if: ${{ runner.os == 'Linux' }}
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Publish
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/master/') }}
run: ./gradlew publish -x requireClean -x signMavenPublication
env:
ORG_GRADLE_PROJECT_mizuleUsername: ${{ secrets.MAVEN_USERNAME }}
ORG_GRADLE_PROJECT_mizulePassword: ${{ secrets.MAVEN_PASSWORD }}