-
Notifications
You must be signed in to change notification settings - Fork 23
103 lines (94 loc) · 3.09 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# This workflow includes a basic build job.
name: build
on:
[push,pull_request]
env:
GLOBAL_CACHE_PATH: |
~/.gradle
~/.m2
GLOBAL_CACHE_KEY: gradle-m2-java-11
GLOBAL_CACHE_RESTORE_KEYS: |
gradle-m2-java-
gradle-m2
BUILD_CACHE_PATH: |
.gradle
./bin
**/bin
**/build
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Build Information
run: echo Building a '${{ github.event_name }}' for target '${{ github.ref }}'.
- name: Checkout
uses: actions/checkout@v2
with:
# pull all the commits, so the commit count will be correct
fetch-depth: 0
- name: Gradle Cache
uses: actions/[email protected]
with:
path: ${{env.GLOBAL_CACHE_PATH}}
key: ${{env.GLOBAL_CACHE_KEY}}
restore-keys: ${{env.GLOBAL_CACHE_RESTORE_KEYS}}
- name: Build Output Cache
uses: actions/[email protected]
with:
path: ${{env.BUILD_CACHE_PATH}}
key: ${{github.ref}}-${{github.run_id}}-${{github.job}}
restore-keys: |
${{github.ref}}
- name: Gradle Build
run: ./gradlew build
javadocs:
name: Javadocs
runs-on: ubuntu-20.04
steps:
- name: Build Information
run: echo Building javadocs for a '${{ github.event_name }}' for target '${{ github.ref }}'.
- name: Checkout
uses: actions/checkout@v2
- name: Gradle Cache
uses: actions/[email protected]
with:
path: ${{env.GLOBAL_CACHE_PATH}}
key: ${{env.GLOBAL_CACHE_KEY}}
restore-keys: ${{env.GLOBAL_CACHE_RESTORE_KEYS}}
- name: Build Output Cache
uses: actions/[email protected]
with:
path: ${{env.BUILD_CACHE_PATH}}
key: ${{github.ref}}-${{github.run_id}}-${{github.job}}
restore-keys: |
${{github.ref}}
- name: Gradle Javadocs
run: ./gradlew javadocs
snapshot:
name: Artifactory Snapshot
needs: [Build, Javadocs]
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/r0.') || startsWith(github.ref, 'refs/heads/r1.')) }}
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# pull all the commits, so the commit count will be correct
fetch-depth: 0
- name: Gradle Cache
uses: actions/[email protected]
with:
path: ${{env.GLOBAL_CACHE_PATH}}
key: ${{env.GLOBAL_CACHE_KEY}}
restore-keys: ${{env.GLOBAL_CACHE_RESTORE_KEYS}}
- name: Build Output Cache
uses: actions/[email protected]
with:
path: ${{env.BUILD_CACHE_PATH}}
key: ${{github.ref}}-${{github.run_id}}-${{github.job}}
restore-keys: |
${{github.ref}}-${{github.run_id}}
${{github.ref}}
- name: Publish Snapshot
run: ./gradlew publish -PpublishUrl=https://maven.pkg.github.com/${{github.repository}} -PpublishUsername==${{github.actor}} -PpublishPassword=${{secrets.GITHUB_TOKEN}} ${{env.GRADLE_OPTS}}