This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
215 lines (200 loc) · 6.58 KB
/
android.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: Android CI
on: push
jobs:
build-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# Release
- name: Import keystore
if: startsWith(github.ref, 'refs/tags/')
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
DECRYPT_SHARED_KEY: ${{ secrets.DECRYPT_SHARED_KEY }}
run: |
echo "$KEYSTORE_BASE64" > app/keystore.jks.asc
gpg -d --passphrase "$DECRYPT_SHARED_KEY" --batch app/keystore.jks.asc >> app/keystore.jks
echo "$KEY_PROPERTIES" > key.properties.asc
gpg -d --passphrase "$DECRYPT_SHARED_KEY" --batch key.properties.asc >> key.properties
- name: Build Release with Gradle
if: "startsWith(github.ref, 'refs/tags/')"
run: |
chmod +x gradlew
./gradlew buildRelease
# Staging
- name: Build Staging with Gradle
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
chmod +x gradlew
./gradlew buildStaging
test-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: Test with Gradle
run: |
chmod +x gradlew
./gradlew test
check-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- name: Check with Gradle
run: |
chmod +x gradlew
./gradlew app:check
package-apk-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# Release
- name: Import keystore
if: startsWith(github.ref, 'refs/tags/')
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
DECRYPT_SHARED_KEY: ${{ secrets.DECRYPT_SHARED_KEY }}
run: |
echo "$KEYSTORE_BASE64" > app/keystore.jks.asc
gpg -d --passphrase "$DECRYPT_SHARED_KEY" --batch app/keystore.jks.asc >> app/keystore.jks
echo "$KEY_PROPERTIES" > key.properties.asc
gpg -d --passphrase "$DECRYPT_SHARED_KEY" --batch key.properties.asc >> key.properties
- name: Package Release with Gradle
if: startsWith(github.ref, 'refs/tags/')
run: |
chmod +x gradlew
./gradlew assembleRelease
- name: Upload Release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: app-apk
path: app/build/outputs/apk/release/app-release.apk
# Staging
- name: Package Staging with Gradle
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
chmod +x gradlew
./gradlew assembleStaging
- name: Upload Staging
if: "!startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: app-apk
path: app/build/outputs/apk/staging/app-staging-unsigned.apk
package-aab-android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
# Release
- name: Import keystore
if: startsWith(github.ref, 'refs/tags/')
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
DECRYPT_SHARED_KEY: ${{ secrets.DECRYPT_SHARED_KEY }}
run: |
echo "$KEYSTORE_BASE64" > app/keystore.jks.asc
gpg -d --passphrase "$DECRYPT_SHARED_KEY" --batch app/keystore.jks.asc >> app/keystore.jks
echo "$KEY_PROPERTIES" > key.properties.asc
gpg -d --passphrase "$DECRYPT_SHARED_KEY" --batch key.properties.asc >> key.properties
- name: Bundle Release with Gradle
if: startsWith(github.ref, 'refs/tags/')
run: |
chmod +x gradlew
./gradlew app:bundleRelease
- name: Upload Release
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: app-aab
path: app/build/outputs/bundle/release/app-release.aab
# Staging
- name: Bundle Staging with Gradle
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
chmod +x gradlew
./gradlew app:bundleStaging
- name: Upload Staging
if: "!startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v3
with:
name: app-aab
path: app/build/outputs/bundle/staging/app-staging.aab
deploy-android:
needs:
- test-android
- build-android
- package-apk-android
- package-aab-android
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: app-apk
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: app-aab
- name: Get the tag name
run: echo "TAG=$(git tag --sort=creatordate | tail -2 | head -1)" >> $GITHUB_ENV
- name: Build Changelog
id: github_release
uses: heinrichreimer/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
sinceTag: ${{ env.TAG }}
issues: true
issuesWoLabels: true
pullRequests: true
prWoLabels: true
filterByMilestone: true
author: true
unreleased: true
compareLink: true
httpCache: true
verbose: true
- name: Echo changelog
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: echo "$CHANGELOG"
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
app-release.apk
app-release.aab
body: ${{ steps.github_release.outputs.changelog }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}