Repository navigation
435 lines (395 loc) · 17.3 KB
/
Copy pathdeploy-app.yml
File metadata and controls
435 lines (395 loc) · 17.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
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# SPDX-FileCopyrightText: AdGuard Software Limited
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Production build & deploy pipeline for AdGuard Mini.
#
# Triggers: semver tag push, manual dispatch, or tag-and-deploy.yml.
# The prerelease suffix selects the channel: no suffix = release,
# -beta.N / -rc.N = beta, -nightly.N = nightly.
#
# Full pipeline map, variants, release checklist:
# docs/production-build-and-deploy.md
name: Deploy App
run-name: 'Deploy ${{ inputs.tag || github.ref_name }}'
on:
push:
tags:
- 'v[0-9]*.[0-9]*.[0-9]*'
workflow_dispatch:
inputs:
tag:
description: 'Semver tag to deploy (e.g. v2.4.0)'
type: string
required: true
slack-channel:
description: 'Slack channel for notifications'
type: string
default: '#adguard-mini-deploy'
workflow_call:
inputs:
tag:
description: 'Semver tag to deploy'
type: string
required: true
slack-channel:
description: 'Slack channel for notifications'
type: string
default: '#adguard-mini-deploy'
permissions:
contents: read
id-token: write
actions: read
concurrency:
group: deploy-${{ inputs.tag || github.ref_name }}
cancel-in-progress: true
jobs:
# ---------------------------------------------------------------------------
# Metadata & constants
# ---------------------------------------------------------------------------
# Parses the tag into version metadata used by every downstream job.
meta:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Version metadata
uses: AdGuardSoftwareLimited/actions/.github/workflows/version-metadata.yml@master
with:
team: mac
tag: ${{ inputs.tag || github.ref_name }}
# Sparkle orders updates by build number, so it must grow monotonically;
# the KV store keeps the counter atomic across runs.
build-number:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Increment build number
needs: [meta]
runs-on: [team-mac]
outputs:
value: ${{ steps.incr.outputs.value }}
steps:
- uses: AdGuardSoftwareLimited/actions/actions/kv-incr@master
id: incr
with:
key: sciter-adguard-mini/build-number
# The runner image lives in the KV store so it can be rotated without edits.
resolve-runner:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Resolve runner
runs-on: [team-mac]
outputs:
image: ${{ steps.kv.outputs.value }}
steps:
- uses: AdGuardSoftwareLimited/actions/actions/kv-get@master
id: kv
with:
key: build-images/macos
# Single source for artifact names, download URLs and the deployer module.
constants:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Constants
needs: [meta, build-number]
runs-on: [team-mac]
outputs:
static-url: ${{ steps.const.outputs.static-url }}
public-github-repo: ${{ steps.const.outputs.public-github-repo }}
sentry-project: ${{ steps.const.outputs.sentry-project }}
app-name: ${{ steps.const.outputs.app-name }}
zip-name: ${{ steps.const.outputs.zip-name }}
zip-stable-name: ${{ steps.const.outputs.zip-stable-name }}
appcast-name: ${{ steps.const.outputs.appcast-name }}
release-notes-url: ${{ steps.const.outputs.release-notes-url }}
download-url: ${{ steps.const.outputs.download-url }}
deployer-module: ${{ steps.const.outputs.deployer-module }}
channel: ${{ steps.const.outputs.channel }}
timestamp: ${{ steps.const.outputs.timestamp }}
steps:
- id: const
env:
VERSION: ${{ needs.meta.outputs.version }}
VERSION_TITLE: ${{ needs.meta.outputs.version-title }}
CHANNEL: ${{ needs.meta.outputs.release-channel }}
BUILD_NUMBER: ${{ needs.build-number.outputs.value }}
run: |
set -euo pipefail
STATIC_URL="https://static.adtidy.org/macmini"
PUBLIC_GITHUB_REPO="AdguardTeam/AdGuardMiniForMac"
SENTRY_PROJECT="adguard-mac-mini"
APP_NAME="AdGuard Mini"
# `.app.zip` is required by the mac-mini-* deployer module file patterns.
ZIP_NAME="AdGuardMini-${VERSION}.${BUILD_NUMBER}.app.zip"
ZIP_STABLE_NAME="AdGuardMini.app.zip"
APPCAST_NAME="adguard-mini-appcast.xml"
RELEASE_NOTES_URL="https://link.adtidy.info/forward.html?app=mini_mac&v=&action=mac_release_notes&from=updater&channel=${CHANNEL}"
DOWNLOAD_URL="${STATIC_URL}/${CHANNEL}/${ZIP_NAME}"
DEPLOYER_MODULE="mac-mini-${CHANNEL}"
echo "static-url=${STATIC_URL}" >> "$GITHUB_OUTPUT"
echo "public-github-repo=${PUBLIC_GITHUB_REPO}" >> "$GITHUB_OUTPUT"
echo "sentry-project=${SENTRY_PROJECT}" >> "$GITHUB_OUTPUT"
echo "app-name=${APP_NAME}" >> "$GITHUB_OUTPUT"
echo "zip-name=${ZIP_NAME}" >> "$GITHUB_OUTPUT"
echo "zip-stable-name=${ZIP_STABLE_NAME}" >> "$GITHUB_OUTPUT"
echo "appcast-name=${APPCAST_NAME}" >> "$GITHUB_OUTPUT"
echo "release-notes-url=${RELEASE_NOTES_URL}" >> "$GITHUB_OUTPUT"
echo "download-url=${DOWNLOAD_URL}" >> "$GITHUB_OUTPUT"
echo "deployer-module=${DEPLOYER_MODULE}" >> "$GITHUB_OUTPUT"
echo "channel=${CHANNEL}" >> "$GITHUB_OUTPUT"
echo "timestamp=$(date +%s)" >> "$GITHUB_OUTPUT"
# ---------------------------------------------------------------------------
# Changelog
#
# collect-changelog.yml uploads with `archive: false`, so the actual GitHub
# artifact is named after the file (`changelog.md` / `changelog.txt`), while
# the `artifact-name` input only appears in the job summary title.
# ---------------------------------------------------------------------------
# QA-facing changelog in Markdown, collected from the private repository.
changelog-qa:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Changelog (QA)
needs: [meta, constants]
uses: AdGuardSoftwareLimited/actions/.github/workflows/collect-changelog.yml@master
with:
team: mac
from-ref: ${{ needs.meta.outputs.previous-tag }}
source: github
format: md
private: 'true'
github-repo: ${{ needs.constants.outputs.public-github-repo }}
artifact-name: qa-changelog
secrets: inherit
# Public changelog from the public mirror (synced by mirror.yml).
changelog-public:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Changelog (public)
needs: [meta, constants]
uses: AdGuardSoftwareLimited/actions/.github/workflows/collect-changelog.yml@master
with:
team: mac
from-ref: ${{ needs.meta.outputs.previous-tag }}
source: github
format: txt
private: 'false'
github-repo: ${{ needs.constants.outputs.public-github-repo }}
artifact-name: changelog
secrets: inherit
# ---------------------------------------------------------------------------
# Nightly
# ---------------------------------------------------------------------------
# Nightly channel only: maintains builds.json for the nightly update feed.
nightly-json:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini' && needs.meta.outputs.release-channel == 'nightly'
name: Nightly builds.json
needs: [meta, build-number, constants, changelog-public]
uses: AdGuardSoftwareLimited/actions/.github/workflows/compose-nightly-json.yml@master
with:
team: mac
build-entry: >-
{"version": "${{ needs.meta.outputs.version }}.${{ needs.build-number.outputs.value }}",
"buildNumber": "${{ needs.build-number.outputs.value }}",
"downloadUrl": "${{ needs.constants.outputs.download-url }}",
"timestamp": ${{ needs.constants.outputs.timestamp }}}
update-url: ${{ needs.constants.outputs.download-url }}
builds-json-url: ${{ needs.constants.outputs.static-url }}/nightly/builds.json
changelog-text: ${{ needs.changelog-public.outputs.changelog-text }}
secrets: inherit
# ---------------------------------------------------------------------------
# Build
# ---------------------------------------------------------------------------
# Both variants use the SAME version/build/channel so the standalone and
# Mac App Store releases always match.
build-standalone:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Build Standalone
needs: [meta, build-number, constants]
uses: ./.github/workflows/build-standalone.yml
secrets: inherit
with:
version: ${{ needs.meta.outputs.version }}
version-title: ${{ needs.meta.outputs.version-title }}
build-number: ${{ needs.build-number.outputs.value }}
channel: ${{ needs.constants.outputs.channel }}
sentry-release: ${{ needs.meta.outputs.raw-version }}
build-mas:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Build MAS
needs: [meta, build-number, constants]
uses: ./.github/workflows/build-mas.yml
secrets: inherit
with:
version: ${{ needs.meta.outputs.version }}
version-title: ${{ needs.meta.outputs.version }}
build-number: ${{ needs.build-number.outputs.value }}
channel: ${{ needs.constants.outputs.channel }}
app-store-info: true
sentry-release: ${{ needs.meta.outputs.raw-version }}
# ---------------------------------------------------------------------------
# Package & sign
# ---------------------------------------------------------------------------
# Renames the notarized zip (keeps a stable copy), reads
# LSMinimumSystemVersion for the appcast, and signs the archive with the
# Sparkle EdDSA key verified by the in-app updater. Runs on a fresh
# ephemeral VM — only the downloaded artifact is needed.
package:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Package & sign
needs: [meta, build-number, constants, resolve-runner, build-standalone]
runs-on:
- ephemeral
- ephemeral-mac
- ${{ needs.resolve-runner.outputs.image }}
- ephemeral-limit-memory-8192
- ephemeral-limit-cpu-4
- ephemeral-limit-disk-gb-20
- ephemeral-job-key-${{ github.run_id }}-${{ github.job }}-${{ strategy.job-index || 0 }}
outputs:
ed-signature: ${{ steps.sparkle-sign.outputs.ed-signature }}
file-length: ${{ steps.sparkle-sign.outputs.file-length }}
min-system-version: ${{ steps.read-info.outputs.min-system-version }}
steps:
- name: Download notarized app
uses: actions/download-artifact@v8
with:
name: AdGuardMini-Release
path: build/Release
- name: Read minimum system version and rename zip
id: read-info
env:
ZIP_NAME: ${{ needs.constants.outputs.zip-name }}
ZIP_STABLE_NAME: ${{ needs.constants.outputs.zip-stable-name }}
run: |
set -euo pipefail
cd build/Release
TMP_PLIST="$RUNNER_TEMP/Info.plist"
unzip -p "AdGuard Mini.app.zip" "AdGuard Mini.app/Contents/Info.plist" > "$TMP_PLIST"
MIN_VERSION=$(/usr/libexec/PlistBuddy -c "Print :LSMinimumSystemVersion" "$TMP_PLIST")
echo "min-system-version=${MIN_VERSION}" >> "$GITHUB_OUTPUT"
mv "AdGuard Mini.app.zip" "${ZIP_NAME}"
cp "${ZIP_NAME}" "${ZIP_STABLE_NAME}"
echo "=== Zip prepared ==="
ls -lh "${ZIP_NAME}" "${ZIP_STABLE_NAME}"
- name: Sign with Sparkle EdDSA
id: sparkle-sign
uses: AdGuardSoftwareLimited/actions/actions/sign-by-sparkle@master
with:
archive-path: build/Release/${{ needs.constants.outputs.zip-name }}
vault-url: ${{ vars.VAULT_URL }}
ak-url: ${{ vars.ARTIFACT_KEEPER_URL }}
- name: Upload deploy artifact
uses: actions/upload-artifact@v7
with:
name: native-zip
path: |
build/Release/${{ needs.constants.outputs.zip-name }}
build/Release/${{ needs.constants.outputs.zip-stable-name }}
retention-days: 7
if-no-files-found: error
# ---------------------------------------------------------------------------
# Appcast
# ---------------------------------------------------------------------------
# Generates the Sparkle appcast XML consumed by the in-app auto-updater.
appcast:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Generate appcast
needs: [meta, build-number, constants, package]
uses: AdGuardSoftwareLimited/actions/.github/workflows/generate-sparkle-appcast.yml@master
with:
team: mac
version: ${{ needs.build-number.outputs.value }}
short-version: ${{ needs.meta.outputs.version-title }}
app-name: ${{ needs.constants.outputs.app-name }}
ed-signature: ${{ needs.package.outputs.ed-signature }}
file-length: ${{ needs.package.outputs.file-length }}
download-url: ${{ needs.constants.outputs.download-url }}
min-system-version: ${{ needs.package.outputs.min-system-version }}
release-notes-url: ${{ needs.constants.outputs.release-notes-url }}
appcast-name: ${{ needs.constants.outputs.appcast-name }}
appcast-title: AdGuard Mini's Changelog
link: ${{ needs.constants.outputs.static-url }}/${{ needs.constants.outputs.channel }}/${{ needs.constants.outputs.appcast-name }}
artifact-name: native-appcast
secrets: inherit
# ---------------------------------------------------------------------------
# Finalize standalone
# ---------------------------------------------------------------------------
# Bundles zips + appcast (+ builds.json) into `native-deploy`; runs even
# if optional stages failed, whenever the package job succeeded.
finalize-standalone:
if: ${{ always() && !cancelled() && github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini' }}
name: Finalize standalone deploy artifact
needs: [constants, package, appcast, nightly-json]
runs-on: [team-mac]
steps:
- name: Download zip artifact
uses: actions/download-artifact@v8
with:
name: native-zip
path: deploy/
- name: Download appcast artifact
uses: actions/download-artifact@v8
with:
name: native-appcast
path: deploy/
- name: Download nightly builds.json
if: needs.nightly-json.result == 'success'
uses: actions/download-artifact@v8
with:
name: builds.json
path: deploy/
- name: Upload final deploy artifact
uses: actions/upload-artifact@v7
with:
name: native-deploy
path: deploy/
retention-days: 7
if-no-files-found: error
# ---------------------------------------------------------------------------
# Deploy
# ---------------------------------------------------------------------------
# Standalone: publishes the bundle to the static storage through the
# channel-specific deployer module, which picks the actual target; the
# deploy is protected by a per-channel deployment environment (may
# require manual approval).
deploy-static:
name: Deploy to static storage
needs: [meta, constants, finalize-standalone]
if: ${{ !cancelled() && needs.meta.result == 'success' && needs.finalize-standalone.result == 'success' && github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini' }}
uses: AdGuardSoftwareLimited/actions/.github/workflows/deploy-to-static.yml@master
with:
team: mac
deployer-module: ${{ needs.constants.outputs.deployer-module }}
artifact-name: native-deploy
environment: ${{ needs.meta.outputs.release-channel }}-static-server
secrets: inherit
# Mac App Store: uploads to TestFlight (internal group); external
# distribution and review submission are done manually afterwards.
deploy-mas:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Deploy MAS to TestFlight
needs: [meta, build-mas]
uses: AdGuardSoftwareLimited/actions/.github/workflows/deploy-to-testflight.yml@master
with:
team: mac
asset-artifact-name: AdGuardMini-MAS
groups: 'App Store Connect Users'
distribute-external: false
submit-beta-review: false
environment: ${{ needs.meta.outputs.release-channel }}-testflight
secrets: inherit
# ---------------------------------------------------------------------------
# Notification
# ---------------------------------------------------------------------------
# A notification failure never fails the deploy (continue-on-error).
slack-notify:
if: github.repository == 'AdGuardSoftwareLimited/sciter-adguard-mini'
name: Slack notification
needs: [meta, build-number, constants, build-mas, finalize-standalone]
uses: AdGuardSoftwareLimited/actions/.github/workflows/slack-build-notify.yml@master
with:
team: mac
channel: ${{ inputs.slack-channel || '#adguard-mini-deploy' }}
product: AdGuard Mini for Mac
version-title: ${{ needs.meta.outputs.version-title }}
metadata: >-
{
"Version": "${{ needs.meta.outputs.version }}",
"Channel": "${{ needs.constants.outputs.channel }}",
"Tag": "${{ inputs.tag || github.ref_name }}",
"Build": "${{ needs.build-number.outputs.value }}"
}
continue-on-error: true
secrets: inherit