-
Notifications
You must be signed in to change notification settings - Fork 146
337 lines (295 loc) · 10.6 KB
/
build_all.yml
File metadata and controls
337 lines (295 loc) · 10.6 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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
name: Build All
run-name: ${{ inputs.release }} @ ${{ github.sha }}
concurrency:
group: delta
permissions:
contents: write
on:
workflow_dispatch:
inputs:
release:
description: Release type
default: beta
type: choice
options:
- beta
- promote
- patch
- minor
- major
publish:
description: Publish the app
type: boolean
default: true
changelog:
description: Changelog (b64 encoded)
env:
token: ${{ secrets.PA_TOKEN || github.token }}
current_repo: ${{ github.repository }}
organization: Delta-Icons
website_repo: Delta-Icons/delta-icons.github.io
package_name: website.leifs.delta
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
with:
token: ${{ env.token }}
fetch-depth: 0
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
with:
add-job-summary: never
- name: Setup Java
uses: actions/setup-java@v5
with:
cache: gradle
distribution: temurin
java-version: 18
- name: Setup Python
uses: actions/setup-python@v6
with:
cache: pip
python-version: '3.13'
- name: Export vars
run: |
python -u resources/scripts/resolve_paths.py -p >> $GITHUB_ENV
due_on=$(TZ=UTC date --iso-8601=seconds -d "$(date +%Y-%m-01) +1 month") >> $GITHUB_ENV
- name: Install Python deps
run: |
pip install -r ${{ env.sd }}/requirements.txt
- name: Install Linux deps
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: optipng
version: 1.0
- name: Configure tools
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
cat << EOF >> $GITHUB_ENV
coauthor='Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>'
EOF
- name: Bump version
run: |
python \
-u ${{ env.sd }}/bump_version.py -e -w \
-r ${{ inputs.release }} >> $GITHUB_ENV
- name: Add icons
run: |
python -u ${{ env.sd }}/add_icons_wrapper.py
- name: Set icons count
run: |
python ${{ env.sd }}/count_icons.py -w
- name: Optimize images
run: |
latest_tag=$(git tag --sort version:refname | grep -v 'beta' | tail -n 1)
changes=$(git diff --name-only $latest_tag -- "***.png")
if [[ $latest_tag && $changes ]]; then
echo "Latest tag is $latest_tag; optimizing images since this tag"
optipng $changes || true
else
echo 'No release tag or changed files found, skip optimizing'
fi
- name: Sort XMLs
run: |
cd ${{ env.sd }}
python sort_appfilter.py -o
python sort_drawable.py -o
cp -fv ${{ env.a1 }} ${{ env.a2 }}
cp -fv ${{ env.d1 }} ${{ env.d2 }}
- name: Create changelog
run: |
mkdir -v changelog
changelog_txt=metadata/en-US/changelogs/${{ env.version_code }}.txt
changelog_tmp=changelog/whatsnew-en-US
changelog_xml=app/src/main/res/values/changelog.xml
python ${{ env.sd }}/create_changelog.py -p -w \
-r ${{ inputs.release }} \
-d '${{ inputs.changelog }}' \
-t $changelog_txt \
-x $changelog_xml
cp $changelog_txt $changelog_tmp
echo "changelog=$changelog_tmp" >> $GITHUB_ENV
- name: Commit pre-release changes
run: |
git add \
app/build.gradle \
app/src/ \
contribs/ \
metadata/ \
resources/vectors/
git commit -m 'Release: ${{ env.version }}' --author "${{ env.coauthor }}"
- name: Build APK
run: |
bash gradlew assemblePlay
- name: Build AAB
run: |
bash gradlew bundlePlay
if: |
inputs.publish == true
- name: Build APK FOSS
run: |
bash gradlew assembleFoss
- name: Build APK FOSS Dynamic Clock
run: |
sed -i 's|<scale factor="1" />|<scale factor="1" />\n\t<dynamic-clock defaultHour="10" defaultMinute="10" defaultSecond="30" hourLayerIndex="0" minuteLayerIndex="1" secondLayerIndex="2" drawable="clock" />|' ${{ env.a1 }} ${{ env.a2 }}
sed -i 's|<category title="Alts" />|<category title="Alts" />\n\t<item drawable="clock_alt_2" />|' ${{ env.d1 }} ${{ env.d2 }}
sed -i 's|MinSdk = 21|MinSdk = 26|' build.gradle
mv -v app/src/main/res/drawable-nodpi/clock.png app/src/main/res/drawable-nodpi/clock_alt_2.png
cat << 'EOF' > app/src/main/res/drawable-nodpi/clock.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/clock_dynamic_background"/>
<foreground>
<layer-list>
<item>
<rotate android:drawable="@drawable/clock_dynamic_hour" android:fromDegrees="300.0" android:toDegrees="5300.0" android:pivotX="50.0%" android:pivotY="50.0%"/>
</item>
<item>
<rotate android:drawable="@drawable/clock_dynamic_minute" android:fromDegrees="60.0" android:toDegrees="60060.0" android:pivotX="50.0%" android:pivotY="50.0%"/>
</item>
<item>
<rotate android:drawable="@drawable/clock_dynamic_second" android:fromDegrees="180.0" android:toDegrees="6180.0" android:pivotX="50.0%" android:pivotY="50.0%" android:level="300"/>
</item>
<item android:drawable="@drawable/clock_dynamic_top" />
</layer-list>
</foreground>
</adaptive-icon>
EOF
python ${{ env.sd }}/sort_appfilter.py -o
python ${{ env.sd }}/sort_drawable.py -o
cp -fv ${{ env.a1 }} ${{ env.a2 }}
cp -fv ${{ env.d1 }} ${{ env.d2 }}
bash gradlew assembleFossdc
git restore ${{ env.d1 }} ${{ env.d2 }}
- name: Move unsigned builds
run: |
find app/build/outputs -regextype posix-egrep -regex '.*-(release|unsigned).(aab|apk)$' | sudo xargs -I % mv -v % .
- name: Sign builds
uses: kevin-david/zipalign-sign-android-release@main
with:
releaseDirectory: .
signingKeyBase64: ${{ secrets.KEYSTORE_BASE64 }}
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
alias: ${{ secrets.KEYSTORE_KEY_ALIAS }}
- name: Rename signed builds
run: |
rm -v *unsigned.apk
mv -v app-fossdc-release-unsigned-signed.apk delta-fossdc-${{ env.version }}.apk
mv -v app-foss-release-unsigned-signed.apk delta-foss-${{ env.version }}.apk
mv -v app-play-release-unsigned-signed.apk delta-gplay-${{ env.version }}.apk
mv -v app-play-release.aab delta-gplay-${{ env.version }}.aab
- name: Upload signed builds to Artifacts
uses: actions/upload-artifact@v5
with:
name: delta-${{ env.version }}
path: delta-*.apk
if-no-files-found: error
retention-days: 30
- name: Push pre-release changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ env.token }}
branch: ${{ github.ref }}
if: |
inputs.publish == true
- name: Create a GitHub release
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ env.is_beta }}
files: 'delta-*.apk'
name: ${{ env.version }}
tag_name: ${{ env.version }}
body_path: ${{ env.changelog }}
if: |
inputs.publish == true
- name: Commit post-release changes
run: |
sed -i '7,/^$/c\\' ${{ env.d1 }} ${{ env.d2 }}
git add ${{ env.d1 }} ${{ env.d2 }}
git commit -m "Cleanup: ${{ env.version }}" --author "${{ env.coauthor }}"
if: |
inputs.release != 'beta' &&
inputs.publish == true
- name: Push post-release changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ env.token }}
branch: ${{ github.ref }}
if: |
inputs.release != 'beta' &&
inputs.publish == true
- name: Upload AAB to Google Play beta channel
uses: r0adkll/upload-google-play@v1
with:
track: beta
status: completed
releaseFiles: delta-gplay-${{ env.version }}.aab
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT }}
packageName: ${{ env.package_name }}
mappingFile: app/build/outputs/mapping/playRelease/mapping.txt
whatsNewDirectory: changelog
inAppUpdatePriority: 5
if: |
github.repository_owner == env.organization &&
inputs.publish == true
- name: Update requests
uses: benc-uk/workflow-dispatch@v1
with:
repo: ${{ github.repository }}
workflow: update_requests.yml
token: ${{ env.token }}
if: |
github.repository_owner == env.organization &&
inputs.publish == true
- name: Promote Google Play beta to production
uses: kevin-david/promote-play-release@v1.1.0
with:
service-account-json-raw: ${{ secrets.SERVICE_ACCOUNT }}
package-name: ${{ env.package_name }}
inapp-update-priority: 5
user-fraction: 1.0
if: |
github.repository_owner == env.organization &&
inputs.release != 'beta' &&
inputs.publish == true
- name: Update website
uses: benc-uk/workflow-dispatch@v1
with:
token: ${{ env.token }}
repo: ${{ env.website_repo }}
workflow: deploy.yml
if: |
github.repository_owner == env.organization &&
inputs.release != 'beta' &&
inputs.publish == true
- name: Close current milestone
uses: oinume/create-scheduled-milestone-action@main
continue-on-error: true
with:
title: ${{ env.version_name }}
state: closed
env:
GITHUB_TOKEN: ${{ env.token }}
if: |
github.repository_owner == env.organization &&
inputs.release != 'beta' &&
inputs.publish == true
- name: Open new milestone
uses: oinume/create-scheduled-milestone-action@main
continue-on-error: true
with:
title: ${{ env.version_next }}
state: open
due_on: '${{ env.due_on }}'
env:
GITHUB_TOKEN: ${{ env.token }}
if: |
github.repository_owner == env.organization &&
inputs.release != 'beta' &&
inputs.publish == true