generated from tozydev/kotlin-paper-template
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (71 loc) · 2.42 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Gradle build
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
outputs:
jdk-version: ${{ steps.get-jdk-version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get JDK version
id: get-jdk-version
run: echo "version=$(grep 'jdkVersion' gradle.properties | cut -d '=' -f2)" >> "$GITHUB_OUTPUT"
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ steps.get-jdk-version.outputs.version }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary-as-pr-comment: on-failure
- name: Grant execute permission to gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
determine-snapshot:
needs: build
if: github.ref_name == 'main'
runs-on: ubuntu-latest
outputs:
is-snapshot: ${{ steps.check.outputs.is-snapshot }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Determine snapshot version
id: check
run: |
VERSION=$(grep 'version=' gradle.properties | cut -d '=' -f2)
if [[ $VERSION == *-SNAPSHOT ]]; then
echo "is-snapshot=true" >> "$GITHUB_OUTPUT"
fi
publish-snapshot:
needs: [ build, determine-snapshot ]
if: github.ref_name == 'main' && needs.determine-snapshot.outputs.is-snapshot
runs-on: ubuntu-latest
environment: Vela Snapshots
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: ${{ needs.build.outputs.jdk-version }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Grant execute permission to gradlew
run: chmod +x gradlew
- name: Publish snapshot
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_velaUsername: ${{ secrets.VELA_USERNAME }}
ORG_GRADLE_PROJECT_velaPassword: ${{ secrets.VELA_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}