-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
211 lines (189 loc) · 7.17 KB
/
nightly-build.yml
File metadata and controls
211 lines (189 loc) · 7.17 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
name: Nightly Build
# Triggered by every push to chore/temp-nightly (which nightly-temp-branch-sync.yml
# force-pushes daily at 4 AM UTC to match main).
# Temporarily now this is pointing to test/temp-nightly instead of chore/temp-nightly.
#
# [skip ci] commits (e.g. version bumps pushed via update-latest-build-version.yml)
# are automatically skipped by GitHub Actions, so this workflow will NOT
# double-trigger on those commits.
#
# Version strategy: exp and rc builds share the same bundle ID (MetaMask) so
# TestFlight requires unique CFBundleVersion per upload. We call the external
# version generator once (→ version N for exp), then locally increment to N+1
# for the rc build. Both builds run in parallel after their respective bumps.
on:
push:
branches:
- test/temp-nightly
workflow_dispatch:
# contents: write required by build.yml update-build-version job (version bump commit push)
permissions:
contents: write
id-token: write
jobs:
bump-version-exp:
name: Bump build version (exp)
uses: ./.github/workflows/update-latest-build-version.yml
permissions:
contents: write
id-token: write
with:
base-branch: ${{ github.ref_name }}
secrets: inherit
bump-version-rc:
name: Bump build version (rc)
needs: [bump-version-exp]
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
commit-hash: ${{ steps.bump.outputs.commit-hash }}
build-version: ${{ steps.bump.outputs.build-version }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.bump-version-exp.outputs.commit-hash }}
fetch-depth: 0
token: ${{ secrets.PR_TOKEN || github.token }}
- name: Increment version for RC build
id: bump
env:
EXP_VERSION: ${{ needs.bump-version-exp.outputs.build-version }}
HEAD_REF: ${{ github.ref_name }}
run: |
RC_VERSION=$((EXP_VERSION + 1))
echo "Exp version: $EXP_VERSION → RC version: $RC_VERSION"
./scripts/set-build-version.sh "$RC_VERSION"
git config user.name metamaskbot
git config user.email metamaskbot@users.noreply.github.com
git add bitrise.yml package.json ios/MetaMask.xcodeproj/project.pbxproj android/app/build.gradle
git commit -m "[skip ci] Bump version number to ${RC_VERSION} (nightly rc)"
git push origin HEAD:"$HEAD_REF" --force-with-lease
echo "commit-hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
echo "build-version=$RC_VERSION" >> "$GITHUB_OUTPUT"
build-exp:
name: Nightly exp build (main-exp)
needs: [bump-version-exp]
uses: ./.github/workflows/build.yml
with:
build_name: main-exp
platform: both
skip_version_bump: true
ref: ${{ needs.bump-version-exp.outputs.commit-hash }}
secrets: inherit
build-rc:
name: Nightly RC build (main-rc)
needs: [bump-version-rc]
uses: ./.github/workflows/build.yml
with:
build_name: main-rc
platform: both
skip_version_bump: true
ref: ${{ needs.bump-version-rc.outputs.commit-hash }}
secrets: inherit
upload-exp-testflight:
name: Upload exp to TestFlight
needs: [build-exp]
runs-on: ghcr.io/cirruslabs/macos-runner:sequoia-xl
environment: apple
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby (iOS)
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb #v1
with:
ruby-version: '3.2.9'
working-directory: ios
bundler-cache: true
- name: Download iOS IPA artifact
uses: actions/download-artifact@v4
with:
name: ios-ipa-main-exp
- name: Find IPA path
id: ipa
run: |
IPA=$(find . -name '*.ipa' -type f | head -1)
if [ -z "$IPA" ]; then
echo "::error::No .ipa file found in artifact"
exit 1
fi
case "$IPA" in /*) ABS="$IPA" ;; *) ABS="$PWD/$IPA" ;; esac
echo "path=$ABS" >> "$GITHUB_OUTPUT"
- name: Setup App Store Connect API Key
run: |
bash scripts/setup-app-store-connect-api-key.sh \
"$APP_STORE_CONNECT_API_KEY_ISSUER_ID" \
"$APP_STORE_CONNECT_API_KEY_KEY_ID" \
"$APP_STORE_CONNECT_API_KEY_KEY_CONTENT"
env:
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
APP_STORE_CONNECT_API_KEY_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_CONTENT }}
- name: Upload to TestFlight
run: |
bash scripts/upload-to-testflight.sh \
"github_actions_main-exp" \
"${{ github.ref_name }}" \
"${{ steps.ipa.outputs.path }}" \
"MetaMask BETA & Release Candidates"
- name: Cleanup API Key
if: always()
run: |
rm -f ios/AuthKey.p8
echo "🧹 Cleaned up API key file"
upload-rc-testflight:
name: Upload RC to TestFlight
needs: [build-rc]
runs-on: ghcr.io/cirruslabs/macos-runner:sequoia-xl
environment: apple
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby (iOS)
uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb #v1
with:
ruby-version: '3.2.9'
working-directory: ios
bundler-cache: true
- name: Download iOS IPA artifact
uses: actions/download-artifact@v4
with:
name: ios-ipa-main-rc
- name: Find IPA path
id: ipa
run: |
IPA=$(find . -name '*.ipa' -type f | head -1)
if [ -z "$IPA" ]; then
echo "::error::No .ipa file found in artifact"
exit 1
fi
case "$IPA" in /*) ABS="$IPA" ;; *) ABS="$PWD/$IPA" ;; esac
echo "path=$ABS" >> "$GITHUB_OUTPUT"
- name: Setup App Store Connect API Key
run: |
bash scripts/setup-app-store-connect-api-key.sh \
"$APP_STORE_CONNECT_API_KEY_ISSUER_ID" \
"$APP_STORE_CONNECT_API_KEY_KEY_ID" \
"$APP_STORE_CONNECT_API_KEY_KEY_CONTENT"
env:
APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
APP_STORE_CONNECT_API_KEY_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_CONTENT }}
- name: Upload to TestFlight
run: |
# Group arg is required as positional placeholder for the 5th arg (distribute_external=false).
# With distribute_external=false the build is uploaded but NOT distributed to external testers.
bash scripts/upload-to-testflight.sh \
"github_actions_main-rc" \
"${{ github.ref_name }}" \
"${{ steps.ipa.outputs.path }}" \
"MetaMask BETA & Release Candidates"
- name: Cleanup API Key
if: always()
run: |
rm -f ios/AuthKey.p8
echo "🧹 Cleaned up API key file"