Repository navigation
270 lines (261 loc) · 10.3 KB
/
Copy pathprepare-app-release.yml
File metadata and controls
270 lines (261 loc) · 10.3 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: Prepare alpha release
on:
workflow_dispatch:
inputs:
channel:
description: Release channel (alpha uploads to internal testing and closed testing)
required: true
default: alpha
type: choice
options:
- alpha
version:
description: 'User-facing version, for example 0.2.0'
required: true
type: string
notes:
description: 'Short release notes (required for Play, maximum 500 characters)'
type: string
upload_to_play:
description: 'Upload the signed AAB to Play internal testing and release it to closed testing (Alpha)'
default: true
type: boolean
dry_run:
description: 'Check and package unsigned artifacts only; create no tag/release or Play upload'
default: false
type: boolean
permissions:
contents: read
concurrency:
group: app-release
cancel-in-progress: false
env:
FASTLANE_SKIP_UPDATE_CHECK: 'true'
FASTLANE_HIDE_CHANGELOG: 'true'
FASTLANE_OPT_OUT_USAGE: 'true'
jobs:
build:
if: github.repository == 'thisislvca/alba' && github.ref == 'refs/heads/main'
name: Build without release credentials
runs-on: ubuntu-24.04
timeout-minutes: 35
permissions:
contents: read
actions: read
outputs:
version_code: ${{ steps.release.outputs.version_code }}
env:
APP_VERSION: ${{ inputs.version }}
APP_CHANNEL: ${{ inputs.channel }}
APP_NOTES: ${{ inputs.notes }}
APP_VERSION_CODE_OFFSET: ${{ vars.APP_VERSION_CODE_OFFSET || '1000' }}
DRY_RUN: ${{ inputs.dry_run }}
UPLOAD_TO_PLAY: ${{ inputs.upload_to_play }}
ALBA_SENTRY_DSN: ${{ vars.ALBA_SENTRY_DSN }}
ALBA_RELEASE_ENVIRONMENT: production
ALBA_SENTRY_PROPERTIES: /tmp/alba-no-sentry.properties
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
package-manager-cache: false
- name: Validate version and source checks
id: release
run: node scripts/release/release.mjs prepare
env:
GH_TOKEN: ${{ github.token }}
- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
distribution: temurin
java-version: '21'
- uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
with:
packages: 'platform-tools platforms;android-37.2 build-tools;37.0.0'
log-accepted-android-sdk-licenses: false
- uses: gradle/actions/setup-gradle@8da46b539cd8fe6ab27ca75128919a18d757604c # v6.4.1
- name: Check and build unsigned candidate
run: |
node --test 'scripts/**/*.test.mjs'
cmp THIRD_PARTY_NOTICES.md app/src/main/res/raw/third_party_notices.txt
./gradlew testDebugUnitTest lintDebug :app:assembleRelease :app:bundleRelease \
"-PalbaVersionName=$APP_VERSION" "-PalbaVersionCode=$VERSION_CODE" \
--max-workers=2 --no-parallel --no-daemon --console=plain
node scripts/release/release.mjs package
env:
VERSION_CODE: ${{ steps.release.outputs.version_code }}
- name: Save unsigned build
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: alba-${{ steps.release.outputs.version_code }}-unsigned
path: |
.artifacts/release/alba.aab
.artifacts/release/mapping.txt
.artifacts/release/release.json
.artifacts/release/SHA256SUMS
.artifacts/release/NOTES.md
if-no-files-found: error
retention-days: 7
sign:
name: Sign approved bundle
needs: build
if: ${{ !inputs.dry_run }}
environment: release-signing
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
contents: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
package-manager-cache: false
- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
distribution: temurin
java-version: '21'
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: alba-${{ needs.build.outputs.version_code }}-unsigned
path: .artifacts/release
- name: Sign and immediately remove the upload key
run: node scripts/release/release.mjs sign
env:
ALBA_UPLOAD_KEYSTORE_BASE64: ${{ secrets.ALBA_UPLOAD_KEYSTORE_BASE64 }}
ALBA_KEYSTORE_PASSWORD: ${{ secrets.ALBA_KEYSTORE_PASSWORD }}
ALBA_KEY_ALIAS: ${{ vars.ALBA_KEY_ALIAS }}
ALBA_UPLOAD_CERT_SHA256: ${{ vars.ALBA_UPLOAD_CERT_SHA256 }}
- name: Remove temporary credentials after interruption
if: always()
run: rm -rf "$RUNNER_TEMP/alba-release-credentials"
- name: Attest the signed bundle and its manifest
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-path: |
.artifacts/release/alba.aab
.artifacts/release/release.json
- name: Save signed candidate
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: alba-${{ needs.build.outputs.version_code }}-signed
path: |
.artifacts/release/alba.aab
.artifacts/release/mapping.txt
.artifacts/release/release.json
.artifacts/release/SHA256SUMS
.artifacts/release/NOTES.md
if-no-files-found: error
retention-days: 30
- name: Create candidate tag and draft GitHub release
run: node scripts/release/release.mjs publish
env:
GH_TOKEN: ${{ github.token }}
internal:
name: Upload to Play internal and closed testing
needs: [build, sign]
if: ${{ !inputs.dry_run && inputs.upload_to_play }}
environment: play-internal
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: read
attestations: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
package-manager-cache: false
- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0
with:
distribution: temurin
java-version: '21'
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: alba-${{ needs.build.outputs.version_code }}-signed
path: .artifacts/release
- name: Verify candidate and provenance
run: node scripts/release/release.mjs check
env:
GH_TOKEN: ${{ github.token }}
- uses: ruby/setup-ruby@145243922b4465b78e04dd66294782c7de45901f # v1
with:
ruby-version: '3.4'
bundler-cache: true
- name: Authenticate to Google with short-lived credentials
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
with:
workload_identity_provider: ${{ vars.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GOOGLE_PLAY_SERVICE_ACCOUNT }}
project_id: lvca-alba-releases
create_credentials_file: true
- name: Upload verified bundle to internal testing and promote it to closed testing
run: bundle exec fastlane android internal
listing:
# The store listing (fastlane/metadata) goes up with every alpha, under the same restricted identity. Its own job, so
# a listing problem shows as a failure here without holding back the build or its prerelease.
name: Update the Play store listing
needs: [build, internal]
if: ${{ !inputs.dry_run && inputs.upload_to_play }}
environment: play-internal
runs-on: ubuntu-24.04
timeout-minutes: 10
env:
ALBA_VERSION_CODE: ${{ needs.build.outputs.version_code }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ruby/setup-ruby@145243922b4465b78e04dd66294782c7de45901f # v1
with:
ruby-version: '3.4'
bundler-cache: true
- name: Authenticate to Google with short-lived credentials
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
with:
workload_identity_provider: ${{ vars.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GOOGLE_PLAY_SERVICE_ACCOUNT }}
project_id: lvca-alba-releases
create_credentials_file: true
- name: Upload the title and descriptions in fastlane/metadata
run: bundle exec fastlane android listing
announce:
name: Publish alpha prerelease
needs: [build, internal]
if: ${{ !inputs.dry_run && inputs.upload_to_play }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: '.nvmrc'
package-manager-cache: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: alba-${{ needs.build.outputs.version_code }}-signed
path: .artifacts/release
- name: Mark the uploaded alpha as a public prerelease
run: node scripts/release/release.mjs announce
env:
GH_TOKEN: ${{ github.token }}