-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
193 lines (172 loc) · 6.47 KB
/
nightly-build.yml
File metadata and controls
193 lines (172 loc) · 6.47 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
name: Nightly Build
# Runs on a schedule (4 AM UTC) like the old nightly-branch-sync.
# Each build creates its own ephemeral branch via create-build-branch.yml,
# so the persistent chore/temp-nightly branch is no longer needed.
#
# iOS builds use build-and-upload-to-testflight.yml (temp branch, build.yml, TestFlight upload).
# Android builds use create-build-branch.yml + build.yml (build artifacts only).
#
# rc depends on exp within each platform stream to ensure the external version
# service produces sequential numbers (N for exp, N+1 for rc).
# iOS and Android streams run in parallel; their version numbers will differ
# but remain unique, which is all TestFlight / Play Store require.
on:
schedule:
# NOTE: Scheduled workflows ALWAYS run from the default branch (main)
- cron: '0 4 * * *'
workflow_dispatch:
permissions:
contents: write
id-token: write
jobs:
# ── iOS exp: build + TestFlight upload ─────────────────────────────────
ios-exp:
name: Nightly iOS exp
uses: ./.github/workflows/build-and-upload-to-testflight.yml
with:
source_branch: main
environment: exp
testflight_group: 'MetaMask BETA & Release Candidates'
distribute_external: true
secrets: inherit
# ── iOS rc: build + TestFlight upload (after exp for sequential versions) ─
ios-rc:
name: Nightly iOS rc
needs: [ios-exp]
uses: ./.github/workflows/build-and-upload-to-testflight.yml
with:
source_branch: main
environment: rc
testflight_group: 'MetaMask BETA & Release Candidates'
distribute_external: true
secrets: inherit
# ── Android exp: ephemeral branch + build ──────────────────────────────
android-exp-branch:
uses: ./.github/workflows/create-build-branch.yml
with:
source_branch: main
secrets: inherit
android-exp:
name: Nightly Android exp
needs: [android-exp-branch]
uses: ./.github/workflows/build.yml
with:
build_name: main-exp
platform: android
skip_version_bump: false
source_branch: ${{ needs.android-exp-branch.outputs.build_branch }}
secrets: inherit
# ── Android rc: ephemeral branch + build (after exp for sequential versions) ─
android-rc-branch:
needs: [android-exp]
uses: ./.github/workflows/create-build-branch.yml
with:
source_branch: main
secrets: inherit
android-rc:
name: Nightly Android rc
needs: [android-rc-branch]
uses: ./.github/workflows/build.yml
with:
build_name: main-rc
platform: android
skip_version_bump: false
source_branch: ${{ needs.android-rc-branch.outputs.build_branch }}
secrets: inherit
# ── Sentry Size Analysis: upload RC builds ────────────────────────────
# Runs in parallel with cleanup/downstream jobs so it never blocks the
# critical path. Uploads nightly RC artifacts so Sentry can track binary
# size over time, surface actionable insights, and auto-compare nightlies.
size-analysis-ios:
name: Sentry Size Analysis (iOS)
needs: [ios-rc]
if: success()
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 2
- name: Resolve base SHA
id: base
run: echo "sha=$(git rev-parse ${{ github.sha }}~1)" >> "$GITHUB_OUTPUT"
- name: Install sentry-cli
run: curl -sL https://sentry.io/get-cli/ | bash
- name: Download iOS xcarchive
uses: actions/download-artifact@v4
with:
name: ios-xcarchive-main-rc
path: ./build-artifacts/
- name: Unzip xcarchive
run: |
cd ./build-artifacts
unzip -q ./*.xcarchive.zip
rm -f ./*.xcarchive.zip
- name: Upload to Sentry Size Analysis
env:
SENTRY_AUTH_TOKEN: ${{ secrets.MM_SENTRY_AUTH_TOKEN }}
run: |
sentry-cli build upload ./build-artifacts/*.xcarchive \
--org metamask \
--project metamask-mobile \
--build-configuration Release-iOS \
--head-sha "${{ github.sha }}" \
--base-sha "${{ steps.base.outputs.sha }}" \
--head-ref main \
--vcs-provider github \
--head-repo-name MetaMask/metamask-mobile
size-analysis-android:
name: Sentry Size Analysis (Android)
needs: [android-rc]
if: success()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
fetch-depth: 2
- name: Resolve base SHA
id: base
run: echo "sha=$(git rev-parse ${{ github.sha }}~1)" >> "$GITHUB_OUTPUT"
- name: Install sentry-cli
run: curl -sL https://sentry.io/get-cli/ | bash
- name: Download Android AAB
uses: actions/download-artifact@v4
with:
name: android-aab-main-rc
path: ./build-artifacts/
- name: Upload to Sentry Size Analysis
env:
SENTRY_AUTH_TOKEN: ${{ secrets.MM_SENTRY_AUTH_TOKEN }}
run: |
sentry-cli build upload ./build-artifacts/*.aab \
--org metamask \
--project metamask-mobile \
--build-configuration Release-Android \
--head-sha "${{ github.sha }}" \
--base-sha "${{ steps.base.outputs.sha }}" \
--head-ref main \
--vcs-provider github \
--head-repo-name MetaMask/metamask-mobile
# ── Cleanup Android ephemeral branches ─────────────────────────────────
# iOS ephemeral branches are cleaned up by build-and-upload-to-testflight.yml.
cleanup:
name: Cleanup Android build branches
needs: [android-exp-branch, android-rc-branch, android-exp, android-rc]
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PR_TOKEN || github.token }}
- name: Delete ephemeral branches
env:
EXP_BRANCH: ${{ needs.android-exp-branch.outputs.build_branch }}
RC_BRANCH: ${{ needs.android-rc-branch.outputs.build_branch }}
run: |
for branch in "$EXP_BRANCH" "$RC_BRANCH"; do
if [ -n "$branch" ]; then
git push origin --delete "$branch" || true
echo "🧹 Deleted: $branch"
fi
done