-
-
Notifications
You must be signed in to change notification settings - Fork 0
270 lines (227 loc) · 9.15 KB
/
release.yaml
File metadata and controls
270 lines (227 loc) · 9.15 KB
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
name: "Release"
on:
workflow_dispatch:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
key_name: zipline-release
package_name: org.cssnr.zipline
jobs:
release:
name: "Release"
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
env:
apk_file: app-release-unsigned.apk
apk_path: app/build/outputs/apk/release
aab_file: app-release.aab
aab_path: app/build/outputs/bundle/release
mapping_file: app/build/outputs/mapping/release/mapping.txt
debug_symbols: app/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib
tools_path: /usr/local/lib/android/sdk/build-tools/36.0.0
cmdline_tools: /usr/local/lib/android/sdk/cmdline-tools/latest/bin
key_file: release.keystore
gradle_file: app/build.gradle.kts
signed_apk: app-release.apk
steps:
- name: "Checkout"
uses: actions/checkout@v6
- name: "Debug Event"
continue-on-error: true
run: |
echo "ref: ${{ github.ref }}"
echo "event_name: ${{ github.event_name }}"
echo "github.event.repository.name: ${{ github.event.repository.name }}"
echo "::group::cat event.json"
cat "${GITHUB_EVENT_PATH}"
echo "::endgroup::"
- name: "Set Tools Path"
run: |
echo "${{ env.tools_path }}" >> "$GITHUB_PATH"
echo "${{ env.cmdline_tools }}" >> "$GITHUB_PATH"
- name: "Verify Tools"
run: |
which keytool
which zipalign
which apksigner
which apkanalyzer
echo "::group::PATH"
echo "${PATH}"
echo "::endgroup::"
echo "::group::ls tools_path"
ls -lAh "${{ env.tools_path }}"
echo "::endgroup::"
- name: "Update Version"
uses: chkfung/android-version-actions@fcf89abef1c7afba2083146dcca0c6da4705ba4b # v1.2.3
id: version
with:
gradlePath: ${{ env.gradle_file }}
versionCode: ${{ github.run_number }}
versionName: ${{ github.ref_name }}
- name: "Debug Version"
continue-on-error: true
run: |
echo "versionCode: ${{ github.run_number }}"
echo "versionName: ${{ github.ref_name }}"
echo "::group::cat ${{ env.gradle_file }}"
cat ${{ env.gradle_file }}
echo "::endgroup::"
- name: "Write Google Services File"
run: |
echo "${{ secrets.GOOGLE_SERVICES }}" | base64 --decode > app/google-services.json
stat app/google-services.json
- name: "Write Keystore File"
run: |
echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > ${{ env.key_file }}
echo ${{ secrets.ANDROID_KEYSTORE_PASS }} | keytool -list -keystore ${{ env.key_file }}
- name: "Setup Node 24"
uses: actions/setup-node@v6
with:
node-version: 24
- name: "Prepare Build"
working-directory: ".github/scripts"
run: |
bash prepare.sh
- name: "Debug Prepare"
continue-on-error: true
run: |
ls .
ls -lAh app
- name: "Setup Java"
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "17"
#cache: "gradle"
- name: "Gradle Assemble APK"
run: |
chmod +x ./gradlew
./gradlew assembleRelease
- name: "Verify APK"
run: |
apkanalyzer -h apk summary "${{ env.apk_path }}/${{ env.apk_file }}"
echo "::group::ls env.apk_path"
ls -lAh ${{ env.apk_path }}
echo "::endgroup::"
- name: "Align APK"
run: |
mv "${{ env.apk_path }}/${{ env.apk_file }}" "${{ env.apk_path }}/source.apk"
zipalign -P 16 -f -v 4 \
"${{ env.apk_path }}/source.apk" \
"${{ env.apk_path }}/${{ env.apk_file }}"
zipalign -c -P 16 -v 4 "${{ env.apk_path }}/${{ env.apk_file }}"
rm -f "${{ env.apk_path }}/source.apk"
- name: "Sign APK"
run: |
apksigner sign --ks ${{ env.key_file }} \
--ks-pass pass:${{ secrets.ANDROID_KEYSTORE_PASS }} \
--ks-key-alias ${{ env.key_name }} \
"${{ env.apk_path }}/${{ env.apk_file }}"
apksigner verify --verbose "${{ env.apk_path }}/${{ env.apk_file }}"
mv "${{ env.apk_path }}/${{ env.apk_file }}" "${{ env.apk_path }}/${{ env.signed_apk }}"
- name: "Upload APK to Artifacts"
uses: actions/upload-artifact@v4
with:
name: release
path: ${{ env.apk_path }}
- name: "Upload APK to Release"
if: ${{ github.event_name == 'release' }}
uses: cssnr/upload-release-action@v1
with:
files: ${{ env.apk_path }}/${{ env.signed_apk }}
overwrite: true
- name: "Gradle Bundle AAB"
if: ${{ !github.event.release.prerelease }}
run: |
chmod +x ./gradlew
./gradlew bundleRelease
- name: "Debug Bundle"
if: ${{ !github.event.release.prerelease }}
continue-on-error: true
run: |
echo "env.aab_path: ${{ env.aab_path }}"
ls -lAh "${{ env.aab_path }}" ||:
echo "env.debug_symbols: ${{ env.debug_symbols }}"
ls -lAh "${{ env.debug_symbols }}" ||:
echo "env.mapping_file: ${{ env.mapping_file }}"
ls -lAh "$(dirname "${{ env.debug_symbols }}")" ||:
- name: "Sign Bundle"
if: ${{ !github.event.release.prerelease }}
run: |
apksigner sign --ks ${{ env.key_file }} \
--min-sdk-version 26 \
--v1-signing-enabled true \
--v2-signing-enabled true \
--ks-pass pass:${{ secrets.ANDROID_KEYSTORE_PASS }} \
--ks-key-alias ${{ env.key_name }} \
"${{ env.aab_path }}/${{ env.aab_file }}"
- name: "Upload Bundle to Artifacts"
if: ${{ !github.event.release.prerelease }}
uses: actions/upload-artifact@v6
with:
name: bundle
path: ${{ env.aab_path }}
- name: "Parse Release Notes"
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
id: notes
run: |
body="${{ github.event.release.body }}"
summary="$(echo "${body%%#*}" | tr -d '\r' | sed ':a;N;$!ba;s/\n*$//')"
echo "summary<<EOF" >> "$GITHUB_OUTPUT"
echo "$summary" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: "Generate Whats New"
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
run: |
mkdir -p whatsNew
echo -n "${{ steps.notes.outputs.summary }}" > whatsNew/whatsnew-en-US
- name: "Upload Google Play"
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
uses: r0adkll/upload-google-play@935ef9c68bb393a8e6116b1575626a7f5be3a7fb # v1.1.3
with:
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_JSON }}
packageName: ${{ env.package_name }}
releaseFiles: ${{ env.aab_path }}/${{ env.aab_file }}
debugSymbols: ${{ env.debug_symbols }}
mappingFile: ${{ env.mapping_file }}
whatsNewDirectory: whatsNew
releaseName: "${{ github.run_number }} (${{ github.ref_name }})"
track: internal
- name: "VirusTotal"
if: ${{ github.event_name == 'release' }}
uses: cssnr/virustotal-action@v1
continue-on-error: true
with:
vt_api_key: ${{ secrets.VT_API_KEY }}
- name: "Update Release Notes Action"
if: ${{ github.event_name == 'release' }}
uses: smashedr/update-release-notes-action@master
continue-on-error: true
with:
type: generic
- name: "Write Job Summary"
if: ${{ !github.event.act }}
continue-on-error: true
run: |
echo -e "## Android Release\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "Final APK: \`${{ env.signed_apk }}\`\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "<details><summary>Build Artifacts</summary>\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "\`\`\`text\n$(ls -lAh ${{ env.apk_path }})\n\`\`\`\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "</details>\n\n" >> "$GITHUB_STEP_SUMMARY"
if [ -f "${{ env.apk_path }}/output-metadata.json" ];then
echo -e "<details><summary>File: output-metadata.json</summary>\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "\`\`\`json\n$(cat ${{ env.apk_path }}/output-metadata.json)\n\`\`\`\n\n" >> "$GITHUB_STEP_SUMMARY"
echo -e "</details>\n\n" >> "$GITHUB_STEP_SUMMARY"
fi
echo -e "\n\n---" >> "$GITHUB_STEP_SUMMARY"
- name: "Send Failure Notification"
if: ${{ failure() && github.event_name == 'release' }}
uses: sarisia/actions-status-discord@eb045afee445dc055c18d3d90bd0f244fd062708 # v1.16.0
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}