-
Notifications
You must be signed in to change notification settings - Fork 33
232 lines (192 loc) · 7.76 KB
/
build-ios.yml
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
name: iOS
on:
workflow_call:
inputs:
environment:
required: true
type: string
branch:
required: true
type: string
jobs:
ios:
name: Build
runs-on: macos-14
environment: client-${{ inputs.environment }}
env:
CI: github
SOURCEMAPS_DIR: ./build/sourcemaps
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
DOTENV_ENVIRONMENT: ${{ vars.ENVIRONMENT }}
DOTENV_DEBUG: ${{ vars.DEBUG }}
DOTENV_ANDROID_CODE_PUSH_DEPLOYMENT_KEY: ${{ vars.ANDROID_CODE_PUSH_DEPLOYMENT_KEY }}
DOTENV_ANDROID_PACKAGE_NAME: ${{ vars.ANDROID_PACKAGE_NAME }}
DOTENV_API_ENDPOINT: ${{ vars.API_ENDPOINT }}
DOTENV_DEEP_LINK_PREFIX: ${{ vars.DEEP_LINK_PREFIX }}
DOTENV_DEEP_LINK_SCHEME: ${{ vars.DEEP_LINK_SCHEME }}
DOTENV_IOS_APPSTORE_ID: ${{ vars.IOS_APPSTORE_ID }}
DOTENV_IOS_CODE_PUSH_DEPLOYMENT_KEY: ${{ vars.IOS_CODE_PUSH_DEPLOYMENT_KEY }}
DOTENV_METRICS_ENDPOINT: ${{ vars.METRICS_ENDPOINT }}
DOTENV_POSTHOG_API_KEY: ${{ vars.POSTHOG_API_KEY }}
DOTENV_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
DOTENV_STORAGE_ENDPOINT: ${{ vars.STORAGE_ENDPOINT }}
DOTENV_STRIPE_APPLE_MERCHANT_IDENTIFIER: ${{ vars.STRIPE_APPLE_MERCHANT_IDENTIFIER }}
DOTENV_STRIPE_PUBLISHABLE_KEY: ${{ vars.STRIPE_PUBLISHABLE_KEY }}
IOS_SCHEME: ${{ vars.IOS_SCHEME }}
IOS_BUNDLE_IDENTIFIER: ${{ vars.IOS_BUNDLE_IDENTIFIER }}
IOS_APPLE_ID: ${{ secrets.IOS_APPLE_ID }}
IOS_APP_STORE_TEAM_ID: ${{ secrets.IOS_APP_STORE_TEAM_ID }}
IOS_DEVELOPER_PORTAL_TEAM_ID: ${{ secrets.IOS_DEVELOPER_PORTAL_TEAM_ID }}
IOS_APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.IOS_APP_STORE_CONNECT_API_ISSUER_ID }}
IOS_APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_ID }}
IOS_APP_STORE_CONNECT_API_KEY_FILE: ${{ secrets.IOS_APP_STORE_CONNECT_API_KEY_FILE }}
MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
steps:
- uses: actions/checkout@v3
with:
lfs: 'true'
- name: Use Ruby 2.7.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
- name: Use Node.js v18.18
uses: actions/setup-node@v3
with:
node-version: 18.18
- name: Install CocoaPods
working-directory: ./client/ios
run: bundle install
- name: Add keys repo access key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.KEYS_REPO_ACCESS_KEY }}
- name: Create Dotenv File
uses: iamsauravsharma/[email protected]
with:
env-prefix: DOTENV_
directory: ./client
- name: Create GoogleService-Info.plist
working-directory: ./client/ios/Supporting
run: echo "${{ secrets.IOS_GOOGLE_SERVICE_PLIST_FILE }}" > ./$IOS_SCHEME/GoogleService-Info.plist
- name: Prepare Source Maps Directory
working-directory: ./client
run: mkdir -p $SOURCEMAPS_DIR
- name: Prepare $GIT_COMMIT_SHORT
working-directory: ./shared
run: ./scripts/getGitCommitShort.sh >> $GITHUB_ENV
- name: Cache Shared Dependencies
id: cache-shared-node-modules
uses: actions/cache@v2
with:
path: ./shared/node_modules
key: shared-node-modules-${{ hashFiles('./shared/yarn.lock') }}
- name: Install Shared Dependencies
if: steps.cache-shared-node-modules.outputs.cache-hit != 'true'
working-directory: ./shared
run: yarn
- name: Cache Content Dependencies
id: cache-content-node-modules
uses: actions/cache@v2
with:
path: ./content/node_modules
key: content-node-modules-${{ hashFiles('./content/yarn.lock') }}
- name: Install Content Dependencies
if: steps.cache-content-node-modules.outputs.cache-hit != 'true'
working-directory: ./content
run: yarn
- name: Cache Client Dependencies
id: cache-client-osx-node-modules
uses: actions/cache@v2
with:
path: ./client/node_modules
key: client-osx-node-modules-${{ hashFiles('./client/yarn.lock') }}
- name: Install Client Dependencies
if: steps.cache-client-osx-node-modules.outputs.cache-hit != 'true'
working-directory: ./client
run: yarn
- name: Cache Client Cocoapods Dependencies
id: cache-client-pods
uses: actions/cache@v2
with:
path: ./client/ios/Pods
key: client-pods-${{ hashFiles('./client/ios/Podfile.lock') }}
- name: Install Client Cocoapods Dependencies
if: steps.cache-client-pods.cache-hit != 'true'
working-directory: ./client/ios
run: bundle exec pod install
- name: Install Fastlane Dependencies
working-directory: ./client/fastlane
run: bundle install
- name: Build Content
working-directory: ./content
run: yarn build
- name: Build & Upload App
working-directory: ./client/fastlane
env:
RUBYOPT: '-rostruct' # TODO: Remove when https://github.com/fastlane/fastlane/pull/21950 gets released
run: bundle exec fastlane ios app
- name: Upload IPA
uses: actions/upload-artifact@v4
if: always()
with:
name: ios-ipa
path: ./client/ios/*.ipa
- name: Upload Logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: ios-build-logs
path: /Users/runner/Library/Logs/gym/*
- name: Generate Source Map
working-directory: ./client
run: >
yarn react-native bundle
--dev false
--entry-file index.js
--platform ios
--bundle-output $SOURCEMAPS_DIR/main.jsbundle
--sourcemap-output $SOURCEMAPS_DIR/main.jsbundle.map
- name: Compile Hermes Bytecode
working-directory: ./client
run: >
ios/Pods/hermes-engine/destroot/bin/hermesc
-O -emit-binary
-output-source-map
-out=$SOURCEMAPS_DIR/main.jsbundle.hbc
$SOURCEMAPS_DIR/main.jsbundle
rm -f $SOURCEMAPS_DIR/main.jsbundle
mv $SOURCEMAPS_DIR/main.jsbundle.hbc $SOURCEMAPS_DIR/main.jsbundle
- name: Compose Hermes Bytecode and Source Map
working-directory: ./client
run: >
mv $SOURCEMAPS_DIR/main.jsbundle.map $SOURCEMAPS_DIR/main.jsbundle.packager.map
node node_modules/react-native/scripts/compose-source-maps.js
$SOURCEMAPS_DIR/main.jsbundle.packager.map
$SOURCEMAPS_DIR/main.jsbundle.hbc.map
-o $SOURCEMAPS_DIR/main.jsbundle.map
node node_modules/@sentry/react-native/scripts/copy-debugid.js
$SOURCEMAPS_DIR/main.jsbundle.packager.map
$SOURCEMAPS_DIR/main.jsbundle.map
rm -f $SOURCEMAPS_DIR/main.jsbundle.packager.map
- name: Upload Source Map to Sentry
working-directory: ./client
run: >
yarn sentry-cli sourcemaps upload
--debug-id-reference
--strip-prefix $PWD
--dist ${{ vars.ENVIRONMENT }}
--release $GIT_COMMIT_SHORT
$SOURCEMAPS_DIR/main.jsbundle
$SOURCEMAPS_DIR/main.jsbundle.map
- name: Associate Commits to Sentry Release
working-directory: ./client
run: yarn sentry-cli releases set-commits --auto $GIT_COMMIT_SHORT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
title: iOS native version bump on ${{ inputs.branch }} (auto generated)
commit-message: Native Version Bump
branch: ${{ inputs.branch }}-ios-native-version-bump