-
Notifications
You must be signed in to change notification settings - Fork 0
181 lines (147 loc) · 5.12 KB
/
buildRelease.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Build Release
on:
release:
# We'll run this workflow when a new GitHub release is created
types: [released]
jobs:
spotless:
name: Spotless
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: spotlessCheck
env:
DEPENDENCY_GITHUB_PACKAGES_PASSWORD: ${{ secrets.DEPENDENCY_GITHUB_PACKAGES_PASSWORD }}
run: |
./gradlew spotlessCheck
assembleRelease:
needs: spotless
name: AssembleRelease
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- name: assembleRelease -x test
env:
DEPENDENCY_GITHUB_PACKAGES_PASSWORD: ${{ secrets.DEPENDENCY_GITHUB_PACKAGES_PASSWORD }}
run: |
./gradlew --scan --stacktrace \
assembleRelease \
androidSourcesJar -x test
- uses: actions/upload-artifact@v2
with:
name: build-files
path: |
./*/build/
retention-days: 1
testRelease:
needs: [ assembleRelease]
name: TestRelease
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- uses: actions/download-artifact@v2
with:
name: build-files
- name: testRelease
env:
DEPENDENCY_GITHUB_PACKAGES_PASSWORD: ${{ secrets.DEPENDENCY_GITHUB_PACKAGES_PASSWORD }}
run: |
./gradlew testRelease
lintRelease:
needs: [ assembleRelease ]
name: LintRelease
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: gradle-${{ runner.os }}-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
- uses: actions/download-artifact@v2
with:
name: build-files
- name: lintRelease
env:
DEPENDENCY_GITHUB_PACKAGES_PASSWORD: ${{ secrets.DEPENDENCY_GITHUB_PACKAGES_PASSWORD }}
run: |
./gradlew lintRelease
publish:
needs: [ testRelease, lintRelease ]
name: Release build and publish
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
# Base64 decodes and pipes the GPG key content into the secret file
- name: Prepare environment
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: |
git fetch --unshallow
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- uses: actions/download-artifact@v2
with:
name: build-files
# Runs upload, and then closes & releases the repository
- name: Publish to MavenCentral
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseRepository
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}