-
Notifications
You must be signed in to change notification settings - Fork 2
289 lines (261 loc) · 9 KB
/
main.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
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
# This is workflow to run tests, build Android app and supply it to Google Play Store. Version 1.
name: CI / CD
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
# push:
# branches: [ "main" ]
# pull_request:
# branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
name:
type: choice
description: Select Platform(s)
options:
- iOS
- Android
- Android and iOS
increment:
type: choice
description: Increment Build and Version number
options:
- 'true'
- 'false'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# Build job needs test !
jobs:
# Run React Native Eslint and Jest tests
test:
if: ${{ false }}
name: Test
# Setup Ubuntu version
runs-on: ubuntu-latest
strategy:
# Node version matrix
matrix:
node-version: [20.11.1]
# Steps
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
# Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
# Install dependencies
- name: Install dependencies
run: yarn install
# Get defaultConfig
- name: Get defaultConfig
env:
defaultConfig: ${{ secrets.DEFAULTCONFIG }}
shell: bash
run: |
touch defaultConfig.ts
echo "$defaultConfig" >> defaultConfig.ts
# Run lint -tests
- name: Run Eslint tests
if: ${{ false }}
run: yarn lint --fix
# Run Jest -tests
- name: Run Jest tests
if: ${{ false }}
run: yarn test
# Decode, Build and sign Android application
build:
if: contains(fromJson('["Android", "Android and iOS"]'), github.event.inputs.name)
# needs: test
name: Android-build
# Set Ubuntu version
runs-on: ubuntu-latest
# Node version matrix
strategy:
matrix:
node-version: [20.11.1]
# Steps
steps:
- name: Checkout to git repository
uses: actions/checkout@v4
# Setup Node
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: |
yarn install
# Get defaultConfig
- name: Get defaultConfig
env:
defaultConfig: ${{ secrets.DEFAULTCONFIG }}
shell: bash
run: |
touch defaultConfig.ts
echo "$defaultConfig" >> defaultConfig.ts
# Get widgetConfig
- name: Get widgetConfig
env:
widgetConfig: ${{ secrets.WIDGETCONFIG }}
shell: bash
run: |
touch widgetConfig.json
echo "$widgetConfig" >> widgetConfig.json
# Set up Java 17
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin' # You can use 'adopt', 'zulu', or another distribution if needed
# Install Ruby
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.0'
# Update bundler
- name: Update bundler
run: bundle update --bundler
working-directory: android
# Bundle install
- name: Bundle install
run: gem install bundler && bundle install
working-directory: android
# Decode upload keystore and Play Store json -key
- name: Decode Service Account Key JSON File
uses: timheuer/base64-to-file@v1
id: service_account_json_file
with:
fileName: "serviceAccount.json"
encodedString: ${{ secrets.GPLAY_SERVICE_ACCOUNT_KEY_JSON }}
- name: Decode Keystore File
uses: timheuer/base64-to-file@v1
id: android_keystore
with:
fileName: "android_keystore.keystore"
encodedString: ${{ secrets.KEYSTORE }}
- name: Fastlane Increment Version Code and Version Name
if: ${{ github.event.inputs.increment == 'true' }}
run: |
git config user.email "[email protected]"
git config user.name "actions"
bundle update fastlane
bundle exec fastlane android increment_android_version should_commit:true should_push:true
working-directory: android
# Build and sign
- name: Build
env:
KEYSTORE: ${{ steps.android_keystore.outputs.filePath }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
ANDROID_PACKAGE_NAME: ${{ secrets.ANDROID_PACKAGE_NAME }}
GPLAY_JSON_KEY_FILE: ${{ steps.service_account_json_file.outputs.filePath }}
# SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_WEB_HOOK_URL }}
run: |
echo "GOOGLE_MAPS_API_KEY=${{ secrets.GOOGLE_MAPS_API_KEY }}" > .env
chmod +x ./gradlew
bundle exec fastlane android build_sign_and_deploy
working-directory: android
# Upload artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: artifact.aab
path: |
${{ github.workspace }}/android/app/build/outputs/bundle/release/*
# Decode, build and sign IOS application
build_ios:
if: contains(fromJson('["iOS", "Android and iOS"]'), github.event.inputs.name)
# needs: test
name: IOS-build
# Set MacOs version
runs-on: macos-15
# Node version matrix
strategy:
matrix:
node-version: [20.11.1]
# Steps
steps:
- name: Checkout to git repository
uses: actions/checkout@v4
# Setup Node
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
# Get defaultConfig
- name: Get defaultConfig
env:
defaultConfig: ${{ secrets.DEFAULTCONFIG }}
shell: bash
run: |
touch defaultConfig.ts
echo "$defaultConfig" >> defaultConfig.ts
# Get widgetConfig
- name: Get widgetConfig
env:
widgetConfig: ${{ secrets.WIDGETCONFIG }}
shell: bash
run: |
touch widgetConfig.json
echo "$widgetConfig" >> widgetConfig.json
# Install Ruby
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.0'
# Update bundler
- name: Update bundler
run: bundle update --bundler
working-directory: ios
# Yarn install
- name: Install dependencies
run: yarn install
# Gem install bundler + bundle install
- name: Install Ruby Dependencies
run: gem install bundler && bundle install && bundle update fastlane
working-directory: ios
# Install Pods
- name: Install pods
run: pod install
working-directory: ios
# Create and encode p12 certificate and import certificate to keychain
- name: Install the Apple certificate and provisioning profile
env:
IOS_DIST_SIGNIN_KEY: ${{ secrets.IOS_DIST_SIGNIN_KEY }}
IOS_DIST_SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
# import certificate from secrets
echo -n "$IOS_DIST_SIGNIN_KEY" | base64 --decode --output $CERTIFICATE_PATH
- name: Fastlane Increment Build and Version Number
if: ${{ github.event.inputs.increment == 'true' }}
run: |
git config user.email "[email protected]"
git config user.name "actions"
bundle exec fastlane ios increment_version should_commit:true should_push:true
working-directory: ios
- name: Build & upload iOS binary
run: |bundle exec fastlane ios build_upload_testflight
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY: ${{ secrets.ASC_KEY }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
CERTIFICATE_PATH: ${{runner.temp}}/build_certificate.p12
IOS_DIST_SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }}
IOS_APP_IDENTIFIER: ${{ secrets.IOS_APP_IDENTIFIER }}
IOS_DEVELOPER_TEAM_ID: ${{ secrets.IOS_DEVELOPER_TEAM_ID }}
IOS_PROVISIONINGPROFILE_NAME: ${{ secrets.IOS_PROVISIONINGPROFILE_NAME }}
IOS_CODE_SIGNING_IDENTITY: ${{ secrets.IOS_CODE_SIGNING_IDENTITY }}
# SLACK_WEB_HOOK_URL: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}
working-directory: ios
- name: Upload app-store ipa and dsyms to artifacts
uses: actions/upload-artifact@v4
with:
name: app-store ipa & dsyms
path: |
${{ github.workspace }}/ios/app/build/*