Repository navigation
236 lines (230 loc) · 10.8 KB
/
Copy pathrelease.yml
File metadata and controls
236 lines (230 loc) · 10.8 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
# GitHub fallback for the Android release axis.
#
# GitLab owns releases: .gitlab-ci.yml runs the same scripts through
# .gitlab/ci/android-release.yml, gated by the $RELEASE_OWNER group variable.
# This file exists for the one situation where that chain cannot run at all --
# the GitLab runner fleet is down -- so a release can still be cut, published to
# the GitHub Release, submitted to Play, and pushed to Xposed-Modules-Repo.
#
# The publishing itself lives in the toolkit
# (magisk317/magisk-ci-toolkit/.github/workflows/release-android.yml,
# .gitlab-ci.yml pins it at the same SHA the GitLab pipeline includes), so the
# two hosts share one implementation instead of two that drift. See
# docs/hosting-cutover.md, "GitHub fallback release chain".
#
# Deploying this file does not enable publishing. GitHub publishes only while the
# repository variable RELEASE_OWNER is exactly `github`:
# Settings -> Secrets and variables -> Actions -> Repository variables
# That equality is deliberate -- sync:github force-pushes every GitLab release
# tag here, so an unset variable would make every mirrored tag a second publish
# from the mirror's own pushes.
#
# Emergency sequence -- the full procedure, including the recovery checklist, is
# docs/github-fallback-release.md in the toolkit. Short form:
# 1. scripts/release/release_tag.sh creates the signed annotated tag locally
# (it sources the toolkit's release/release_tag.sh; no signing key exists
# on GitHub and none is created here).
# 2. push the branch and the tag to github only. sync:github cannot run while
# the fleet is down, so the mirror push is manual -- and pushing the tag to
# GitLab now would queue a tag pipeline that publishes a second time as
# soon as a runner returns. The tag goes back during recovery.
# 3. set RELEASE_OWNER=github on this repository.
# 4. Run workflow -> Release, tag name, publish switches as required.
# Steps 3 and 4 are the only actions that produce external side effects, so
# rehearse first with dry_run=true and RELEASE_OWNER left as `gitlab`: a dry
# run builds and verifies and writes nothing outside the runner. It does not
# need a tag that exists yet, because the guard compares the tag name with
# versionName -- so the next version is a valid rehearsal target.
# 5. When GitLab runners are back, run the toolkit's
# release/reconcile_github_refs.sh (read-only first, then --apply) and only
# then set RELEASE_OWNER back, or the next sync:github force-push overwrites
# whatever this chain published.
#
# Telegram is not part of this chain. The release card is reviewed by a human
# before it goes out (notification.yml stays workflow_dispatch only), so nothing
# here sends it automatically.
name: Release
# Manual-only by policy (2026-10-25): automatic triggers are removed so this file
# can never start on its own. Release automation is driven from the project's
# primary CI host; runs on this mirror are operator-initiated, and the inputs
# below are the only way any publishing step turns on.
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Signed release tag to publish (created locally with scripts/release/release_tag.sh)'
required: true
type: string
publish_github_release:
description: 'Create or update the GitHub Release'
type: boolean
default: true
publish_play:
description: 'Submit the Play bundle to Google Play'
type: boolean
default: true
publish_modules_repo:
description: 'Publish the channel tag to Xposed-Modules-Repo'
type: boolean
default: true
dry_run:
description: 'Build and verify only; no GitHub Release, Play or Xposed-Modules-Repo side effects'
type: boolean
default: false
permissions:
contents: read
# A half-finished publish must never be cancelled out from under a re-run: the
# GitHub Release would exist without the Xposed-Modules-Repo channel tag, and the
# next run would upload into that mixture.
concurrency:
group: release-${{ inputs.release_tag }}
cancel-in-progress: false
jobs:
# Decides, and says out loud why. A fallback workflow that silently produced an
# empty green run is how a release gets "published" by nobody.
release-eligibility:
name: Check release ownership
runs-on: ubuntu-26.04
outputs:
proceed: ${{ steps.gate.outputs.proceed }}
publishes: ${{ steps.gate.outputs.publishes }}
steps:
- id: gate
shell: bash
env:
OWNER: ${{ vars.RELEASE_OWNER }}
EVENT: ${{ github.event_name }}
DRY_RUN: ${{ inputs.dry_run }}
run: |
set -euo pipefail
proceed=false
publishes=false
mode=''
if [[ "$OWNER" == "github" ]]; then
proceed=true
if [[ "$DRY_RUN" == "true" ]]; then
mode='dry run while RELEASE_OWNER=github'
else
publishes=true
mode='publishing (RELEASE_OWNER=github)'
fi
elif [[ "$DRY_RUN" == "true" ]]; then
# A rehearsal writes nothing outside the runner, so it is allowed
# while GitLab still owns the release.
proceed=true
mode="dry run (RELEASE_OWNER=${OWNER:-unset})"
else
# Only a dispatch can reach this file, so arriving here means the
# operator dispatched a publishing run without owning the release.
echo "::error::GitHub is not the release owner (RELEASE_OWNER=${OWNER:-unset})."
echo " Either set RELEASE_OWNER=github on this repository to publish from here,"
echo " or re-run with dry_run checked to rehearse without side effects."
exit 1
fi
echo "proceed=$proceed" >> "$GITHUB_OUTPUT"
echo "publishes=$publishes" >> "$GITHUB_OUTPUT"
{
echo "### Release eligibility"
echo ""
echo "- Event: \`$EVENT\`"
echo "- RELEASE_OWNER: \`${OWNER:-unset}\`"
echo "- Decision: **$mode**"
} >> "$GITHUB_STEP_SUMMARY"
release:
name: Release (toolkit chain)
needs: release-eligibility
if: needs.release-eligibility.outputs.proceed == 'true'
permissions:
contents: write
uses: magisk317/magisk-ci-toolkit/.github/workflows/release-android.yml@b2d1d58abfca674a60277ba302d06eae45da3ce4
with:
# Must equal the ref above, MAGISK_CI_TOOLKIT_REF and every GitLab
# include.ref; ci/verify_toolkit_pin.sh in the toolkit checks it.
toolkit_ref: b2d1d58abfca674a60277ba302d06eae45da3ce4
release_tag: ${{ inputs.release_tag }}
package_name: com.github.tianma8023.xposed.smscode
release_cert_sha256: 027b936e1d82a606d83599548b8b11e49a2c8ae2588c4a9fbe8311e2c54f103a
# The same project-specific values .gitlab-ci.yml passes to the GitLab
# release templates, under the input names that mirror those variables.
apk_tasks: :app:assembleGithubRelease
gradle_extra_args: -PbuildSplits
aab_tasks: :app:bundlePlayRelease
play_track_override: production
initial_version_code: '126'
modules_repo: Xposed-Modules-Repo/com.github.tianma8023.xposed.smscode
play_url: https://play.google.com/store/apps/details?id=com.github.tianma8023.xposed.smscode
gitlab_project_url: https://gitlab.com/magisk3171/XposedSmsCode
# github_repository is left at its default: the calling repository already
# is magisk317/XposedSmsCode, and the GitLab value exists only because
# that pipeline runs somewhere else.
#
# MAGISK_ANDROID_RELEASE_GITHUB_ASSET_PATTERN is overridden to *.apk in
# .gitlab-ci.yml because this app ships every ABI to the GitHub Release;
# the toolkit default publishes only the arm64 artifact.
github_asset_pattern: '*.apk'
# The GitLab GitHub-release job attaches APKs only; the bundle goes to
# Play. The previous in-repo chain attached the .aab here as well, which is
# one of the divergences this file removes.
attach_aab: false
# On a tag push every channel is on, exactly as the old chain behaved. On a
# dispatch the operator picks; dry_run still turns all of them off inside
# the chain.
publish_github_release: ${{ inputs.publish_github_release }}
publish_play: ${{ inputs.publish_play }}
publish_modules_repo: ${{ inputs.publish_modules_repo }}
dry_run: ${{ inputs.dry_run }}
enabled: ${{ needs.release-eligibility.outputs.proceed == 'true' }}
# Submodules are GitLab-hosted, so the chain needs GITLAB_TOKEN to check
# them out; it arrives through `secrets: inherit`.
checkout_submodules: recursive
secrets: inherit
# Project-specific and stays here: the task list is this app's quality gate, not
# a release-chain concern. Runs after the publish jobs, as it did before.
post-release-quality:
name: Post-release Quality
needs: [release-eligibility, release]
# Only after a real publish from this host. A dry run has nothing to guard,
# and an emergency release should not spend the runner minutes on the test
# suite before the artifact is out -- the suite is what CI runs on beta.
if: needs.release-eligibility.outputs.publishes == 'true'
runs-on: ubuntu-26.04
steps:
- name: Configure GitLab submodule credentials
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
if [[ -z "$GITLAB_TOKEN" ]]; then
echo "::error::GITLAB_TOKEN secret is not set; cannot clone gitlab.com submodules"
exit 1
fi
git config --global http.https://gitlab.com/.extraheader "AUTHORIZATION: basic $(printf 'oauth2:%s' "$GITLAB_TOKEN" | base64 -w0)"
- uses: actions/checkout@v7
with:
submodules: recursive
fetch-depth: 0
- uses: ./.github/actions/resolve-ci-toolkit
with:
ref: b2d1d58abfca674a60277ba302d06eae45da3ce4
- name: Setup Android CI
uses: ./.magisk-ci-toolkit/.github/actions/setup-android-ci
with:
checkout: 'false'
- name: Run post-release quality gate
uses: ./.magisk-ci-toolkit/.github/actions/run-gradle-with-retry
with:
arguments: >
--warning-mode all
:presentation:check
:runtime:check
:app:check
:smscode-core:contract:test
:smscode-core:domain:test
:smscode-core:hook:testDebugUnitTest
:smscode-core:runtime:testDebugUnitTest
:smscode-core:verification:detekt
:smscode-core:verification:test
:magisk-xposed-kit:testDebugUnitTest
:magisk-xposed-kit:logging:jvmTest
:magisk-xposed-kit:diagnostics:testDebugUnitTest
:app:koverVerifyGithubDebug
-PenableKover=true