-
Notifications
You must be signed in to change notification settings - Fork 33
231 lines (208 loc) · 8.91 KB
/
build-internal.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
name: Internal builds
on:
pull_request:
branches: [ "koni-dev", "upgrade-ui" ]
jobs:
# iOS build workflow -------------------------------------------------
build-ios:
name: iOS builds
runs-on: macos-13
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
KS_PASSWORD: ${{ secrets.KS_PASSWORD }}
NEXTCLOUD_CONFIG: ${{ secrets.NEXTCLOUD_CONFIG }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
COMMIT_MESSAGE: ${{ github.event.pull_request.title }}
REF_NAME: ${{ github.ref_name }}
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
IOS_CODEPUSH_KEY: ${{ secrets.IOS_CODEPUSH_STAGING_KEY }}DISABLED
ANDROID_CODEPUSH_KEY: ${{ secrets.ANDROID_CODEPUSH_STAGING_KEY }}DISABLED
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: Add APP ENV
run: |
cp .env.development.example .env.production
if [ -f .env.production ]; then
sed -i '' "s/^TRANSAK_API_KEY=.*/TRANSAK_API_KEY=$TRANSAK_API_KEY/" .env.production
sed -i '' "s/^COINBASE_PAY_ID=.*/COINBASE_PAY_ID=$COINBASE_PAY_ID/" .env.production
sed -i '' "s/^IOS_CODEPUSH_KEY=.*/IOS_CODEPUSH_KEY=$IOS_CODEPUSH_KEY/" .env.production
sed -i '' "s/^ANDROID_CODEPUSH_KEY=.*/ANDROID_CODEPUSH_KEY=$ANDROID_CODEPUSH_KEY/" .env.production
sed -i '' "s/^BUNDLE_ENV=.*/BUNDLE_ENV=STAGING/" .env.production
else
echo "TRANSAK_API_KEY=$TRANSAK_API_KEY" >> .env.production
echo "COINBASE_PAY_ID=$COINBASE_PAY_ID" >> .env.production
echo "IOS_CODEPUSH_KEY=$IOS_CODEPUSH_KEY" >> .env.production
echo "ANDROID_CODEPUSH_KEY=$ANDROID_CODEPUSH_KEY" >> .env.production
echo "BUNDLE_ENV=STAGING" >> .env.production
fi
- name: Use Node.js 18
uses: actions/setup-node@v4
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
with:
node-version: 18
cache: 'yarn'
- name: Cache Yarn dependencies
uses: actions/cache@v3
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
id: yarn-cache # optional, but allows referencing the step
with:
path: |
.yarn/cache
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable | grep -v 'YN0013'
- name: Restore Pods Cache
uses: actions/cache@v3
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
with:
path: |
ios/Pods
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods
run: cd ios && pod update hermes-engine --no-repo-update && cd ..
# Build IPA file
- name: iOS Build Action
uses: yukiarrr/ios-build-action@v1.11.0
with:
project-path: ios/SubWalletMobile.xcodeproj
export-method: 'ad-hoc'
p12-base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
certificate-password: ${{ secrets.P12_PASSWORD }}
mobileprovision-base64: ${{ secrets.BUILD_ADHOC_PROVISION_PROFILE_BASE64 }}
code-signing-identity: 'Apple Distribution: CDM SOFTWARE DEVELOPMENT COMPANY LIMITED (ZUZ7T3GQMT)'
team-id: ${{ secrets.APPLE_TEAM_ID }}
workspace-path: ios/SubWalletMobile.xcworkspace
scheme: SubWalletMobile-Production
- name: Upload iOS to Diawi
id: upload-diawi-ios
uses: rnkdsh/action-upload-diawi@v1.5.4
with:
token: ${{ secrets.DIAWI_TOKEN }}
file: output.ipa
# Notify Discord
- name: Notify to Discord
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
username: GitHub Actions Test Notifier
title: ${{ github.workflow }}
description: |
iOS: The Deployment has been completed.
URL: ${{ steps.upload-ios.outputs.fileUrl }}
Diawi: ${{ steps.upload-diawi-ios.outputs.url }}
Diawi QR: ${{ steps.upload-diawi-ios.outputs.qrcode }}
# Android build workflow -------------------------------------------------
build-android:
name: Android builds
runs-on: macos-12
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_RELEASE_GITHUB_API_TOKEN: ${{ secrets.GH_PAT }}
KS_PASSWORD: ${{ secrets.KS_PASSWORD }}
NEXTCLOUD_CONFIG: ${{ secrets.NEXTCLOUD_CONFIG }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
COMMIT_MESSAGE: ${{ github.event.pull_request.title }}
REF_NAME: ${{ github.ref_name }}
TRANSAK_API_KEY: ${{ secrets.TRANSAK_API_KEY }}
COINBASE_PAY_ID: ${{ secrets.COINBASE_PAY_ID }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: Remove unused web-runner for Android
run: |
rm -r ./html/OldWeb.bundle
- name: Add APP ENV
run: |
cp .env.development.example .env.production
if [ -f .env.production ]; then
sed -i '' "s/^TRANSAK_API_KEY=.*/TRANSAK_API_KEY=$TRANSAK_API_KEY/" .env.production
sed -i '' "s/^COINBASE_PAY_ID=.*/COINBASE_PAY_ID=$COINBASE_PAY_ID/" .env.production
sed -i '' "s/^IOS_CODEPUSH_KEY=.*/IOS_CODEPUSH_KEY=$IOS_CODEPUSH_KEY/" .env.production
sed -i '' "s/^ANDROID_CODEPUSH_KEY=.*/ANDROID_CODEPUSH_KEY=$ANDROID_CODEPUSH_KEY/" .env.production
sed -i '' "s/^BUNDLE_ENV=.*/BUNDLE_ENV=STAGING/" .env.production
else
echo "TRANSAK_API_KEY=$TRANSAK_API_KEY" >> .env.production
echo "COINBASE_PAY_ID=$COINBASE_PAY_ID" >> .env.production
echo "IOS_CODEPUSH_KEY=$IOS_CODEPUSH_KEY" >> .env.production
echo "ANDROID_CODEPUSH_KEY=$ANDROID_CODEPUSH_KEY" >> .env.production
echo "BUNDLE_ENV=STAGING" >> .env.production
fi
- name: Use Node.js 18
uses: actions/setup-node@v4
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
with:
node-version: 18
cache: 'yarn'
- name: Cache Yarn dependencies
uses: actions/cache@v3
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
id: yarn-cache # optional, but allows referencing the step
with:
path: |
.yarn/cache
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/setup-java@v1
with:
java-version: '11'
- name: Cache Gradle Wrapper
uses: actions/cache@v3
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v3
if: ${{ runner.name != 'Dos-Mac-mini' && runner.name != 'Mac-x86' }}
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Install dependencies
run: yarn install --immutable | grep -v 'YN0013'
- name: Prepare sign datarun
run: |
echo "${{ secrets.ANDROID_KEY_STORE_BASE64 }}" | base64 --decode > android/app/${{ secrets.MYAPP_UPLOAD_STORE_FILE }}
# Build APK file
- name: Generate App APK
run: |
cd android && export ENVFILE=.env.production && ./gradlew assembleRelease -PMYAPP_UPLOAD_STORE_FILE=${{ secrets.MYAPP_UPLOAD_STORE_FILE }} -PMYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.ANDROID_KEY_STORE_PASSWORD }} -PMYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.ANDROID_KEY_PASSWORD }} -PMYAPP_UPLOAD_KEY_ALIAS=${{ secrets.ANDROID_ALIAS }}
- name: Upload Android to Diawi
id: upload-diawi-android
uses: rnkdsh/action-upload-diawi@v1.5.4
with:
token: ${{ secrets.DIAWI_TOKEN }}
file: ./android/app/build/outputs/apk/release/app-release.apk
# Notify to Discord
- name: Notify to Discord
uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ job.status }}
username: GitHub Actions Test Notifier
title: ${{ github.workflow }}
description: |
Android: The Deployment has been completed.
Diawi: ${{ steps.upload-diawi-android.outputs.url }}
Diawi QR: ${{ steps.upload-diawi-android.outputs.qrcode }}