forked from organicmaps/organicmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (208 loc) · 8.95 KB
/
Copy pathandroid-release.yaml
File metadata and controls
232 lines (208 loc) · 8.95 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
name: Android Release
on:
workflow_dispatch: # Manual trigger
env:
RELEASE_NOTES: android/app/src/google/play/release-notes/en-US/default.txt
FDROID_VERSION: android/app/src/fdroid/play/version.yaml
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
jobs:
tag:
name: Tag
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout sources
uses: actions/checkout@v6
with:
fetch-depth: 100 # Enough to get all commits for the last day.
ssh-key: ${{ secrets.RELEASE_SSH_KEY }}
- name: Tag
id: tag
shell: bash
run: |
set -x
git config user.name '${{ github.actor }}'
git config user.email '${{ github.actor }}@users.noreply.github.com'
version=$(tools/unix/version.sh ios_version)
# +1 because below a "Bump versions" commit is created.
# TODO: Find a way to refactor FDroid versioning without that additional commit.
build=$(($(tools/unix/version.sh count) + 1))
code=$(($(tools/unix/version.sh android_code) + 1))
tag=$version-$build-android
echo "version=$version" >> $GITHUB_OUTPUT
echo "build=$build" >> $GITHUB_OUTPUT
echo "tag=$tag" >> $GITHUB_OUTPUT
echo "code=$code" >> $GITHUB_OUTPUT
echo "version: ${version}-${build}-FDroid+${code}" > ${{ env.FDROID_VERSION }}
git add ${{ env.FDROID_VERSION }}
{
echo $tag
echo
cat ${{ env.RELEASE_NOTES }}
} > ${{ runner.temp }}/tag.txt
branch="${GITHUB_REF#refs/heads/}"
test -n "$branch"
git commit -m "Bump versions" -s
git tag -a $tag -F ${{ runner.temp }}/tag.txt
git show $tag
git push origin $branch:$branch
git push origin $tag:$tag
outputs:
version: ${{ steps.tag.outputs.version }}
build: ${{ steps.tag.outputs.build }}
code: ${{ steps.tag.outputs.code }}
tag: ${{ steps.tag.outputs.tag }}
android-release:
name: Android Release
runs-on: ubuntu-latest
environment: production
permissions:
contents: write # To publish the release on GitHub Releases.
discussions: write # To publish the release on GitHub Discussions.
needs: tag
strategy:
fail-fast: false
matrix:
include:
- flavor: google
- flavor: huawei
- flavor: web
steps:
- name: Install build tools and dependencies
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build
- name: Checkout sources
uses: actions/checkout@v6
with:
fetch-depth: 100 # enough to get all commits for the current day
ref: 'refs/tags/${{ needs.tag.outputs.tag }}'
- name: Restore Boost submodule from cache
uses: actions/cache@v5
with:
path: |
3party/boost
.git/modules/3party/boost
key: boost-submodule
- name: Check tag
shell: bash
run: |
git show HEAD
test -n "${{ needs.tag.outputs.tag }}"
test "$(git tag --points-at HEAD)" = "${{ needs.tag.outputs.tag }}"
- name: Parallel submodules checkout
shell: bash
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
- name: Checkout screenshots
uses: actions/checkout@v6
with:
repository: ${{ secrets.SCREENSHOTS_REPO }}
ssh-key: ${{ secrets.SCREENSHOTS_SSH_KEY }}
ref: master
path: screenshots
- name: Restore release keys
shell: bash
run: |
echo "$PRIVATE_H" | base64 -d > private.h
echo "$GOOGLE_PLAY_JSON" | base64 -d > android/app/google-play.json
echo "$HUAWEI_APPGALLERY_JSON" | base64 -d > android/app/huawei-appgallery.json
echo "$AGCONNECT_SERVICES_JSON" | base64 -d > android/app/agconnect-services.json
echo "$SECURE_PROPERTIES" | base64 -d > android/app/secure.properties
echo "$RELEASE_KEYSTORE" | base64 -d > android/app/release.keystore
env:
PRIVATE_H: ${{ secrets.PRIVATE_H }}
GOOGLE_PLAY_JSON: ${{ secrets.GOOGLE_PLAY_JSON }}
HUAWEI_APPGALLERY_JSON: ${{ secrets.HUAWEI_APPGALLERY_JSON }}
AGCONNECT_SERVICES_JSON: ${{ secrets.AGCONNECT_SERVICES_JSON }}
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
- name: Configure repository
shell: bash
run: ./configure.sh
- name: Set up SDK
shell: bash
run: echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties
# Compile steps are separated from upload steps to save built artifacts and debug symbols inbetween.
- name: Compile for Google Play
if: ${{ matrix.flavor == 'google' }}
shell: bash
working-directory: android
run: ./gradlew bundleGoogleRelease
- name: Compile for Huawei AppGallery
if: ${{ matrix.flavor == 'huawei' }}
shell: bash
working-directory: android
run: ./gradlew bundleHuaweiRelease
- name: Compile universal web APK
if: ${{ matrix.flavor == 'web' }}
shell: bash
working-directory: android
run: ./gradlew assembleWebRelease
- name: Upload web debug symbols to GitHub artifacts # Google and Huawei include debug symbols inside the aab.
if: ${{ matrix.flavor == 'web' }}
uses: actions/upload-artifact@v7
with:
name: native-debug-symbols-web.zip
path: android/app/build/outputs/native-debug-symbols/webRelease/native-debug-symbols.zip
- name: Upload Google aab to GitHub artifacts
if: ${{ matrix.flavor == 'google' }}
uses: actions/upload-artifact@v7
with:
name: OrganicMaps-${{ needs.tag.outputs.code }}-google-release.aab
path: ./android/app/build/outputs/bundle/googleRelease/OrganicMaps-${{ needs.tag.outputs.code }}-google-release.aab
- name: Upload Huawei aab to GitHub artifacts
if: ${{ matrix.flavor == 'huawei' }}
uses: actions/upload-artifact@v7
with:
name: OrganicMaps-${{ needs.tag.outputs.code }}-huawei-release.aab
path: ./android/app/build/outputs/bundle/huaweiRelease/OrganicMaps-${{ needs.tag.outputs.code }}-huawei-release.aab
- name: Upload to Google Play
if: ${{ matrix.flavor == 'google' }}
shell: bash
working-directory: android
run: ./gradlew publishGoogleReleaseBundle
- name: Upload to Huawei AppGallery
if: ${{ matrix.flavor == 'huawei' }}
shell: bash
working-directory: android
run: ./gradlew publishHuaweiAppGalleryHuaweiRelease
- name: sha256sum web release apk
if: ${{ matrix.flavor == 'web' }}
shell: bash
working-directory: android/app/build/outputs/apk/web/release
run: sha256sum OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk > OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk.sha256sum
- name: Upload web release apk and its sha256sum to GitHub artifacts
if: ${{ matrix.flavor == 'web' }}
uses: actions/upload-artifact@v7
with:
name: OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk
path: ./android/app/build/outputs/apk/web/release/OrganicMaps-${{ needs.tag.outputs.code }}-web-release.*
- name: Prepare release notes
if: ${{ matrix.flavor == 'web' }}
shell: bash
run: |
{
cat ${{ env.RELEASE_NOTES }}
echo ""
echo "See [a detailed announce](https://organicmaps.app/news/) on our website when app updates are published in all stores."
echo "You can get automatic app updates from GitHub [using Obtainium](https://github.com/organicmaps/organicmaps/wiki/Installing-Organic-Maps-from-GitHub-using-Obtainium)."
echo ""
echo "sha256sum:"
echo -e '\n```'
tr -d '\n' < ./android/app/build/outputs/apk/web/release/OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk.sha256sum
echo -e '\n```'
} > ${{ runner.temp }}/release-notes.txt
- name: Upload universal APK to GitHub
if: ${{ matrix.flavor == 'web' }}
uses: softprops/action-gh-release@v2
with:
body_path: ${{ runner.temp }}/release-notes.txt
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ needs.tag.outputs.tag }}
tag_name: ${{ needs.tag.outputs.tag }}
discussion_category_name: 'Announcements'
files: |
./android/app/build/outputs/apk/web/release/OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk
./android/app/build/outputs/apk/web/release/OrganicMaps-${{ needs.tag.outputs.code }}-web-release.apk.sha256sum
fail_on_unmatched_files: true