-
Notifications
You must be signed in to change notification settings - Fork 111
311 lines (251 loc) · 10.7 KB
/
build.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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
name: Build
on: [push, workflow_dispatch]
env:
node_version: 14.x
electron_folder: ./electron
jobs:
environment:
name: 🌱 Load Environment
runs-on: macos-latest
outputs:
package_version: ${{ steps.load_package_version.outputs.package_version }}
package_name: ${{ steps.load_package_name.outputs.package_name }}
app_name: ${{ steps.load_app_name.outputs.app_name }}
steps:
- uses: actions/checkout@v2
- name: ⚙️ Node.js version used - ${{ env.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.node_version }}
- id: load_package_version
name: 🌱 Set package version in environment
run: echo "::set-output name=package_version::$(node -p -e "require('./package.json').version")"
- id: load_package_name
name: 🌱 Set package name in environment
run: echo "::set-output name=package_name::$(node -p -e "require('./package.json').name")"
- id: load_app_name
name: 🌱 Set app name in environment
run: echo "::set-output name=app_name::$(node -p -e "require('./capacitor.config.json').appName")"
test:
name: 🧪 Test
runs-on: ${{ matrix.os }}
needs: environment
strategy:
matrix:
os: ['ubuntu-latest']
steps:
- uses: actions/checkout@v2
- name: 🔧 Installation of dependencies
run: yarn run install-test-dependencies && yarn install # This is only for tests, so no frozen lockfile needed
- name: 🧪 Test CI
run: yarn run test-ci
- name: 🧪 Lint CI
run: yarn run lint-ci
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v2
with:
name: '${{ runner.os }} - Lint Report'
path: ./lintReport.json
prebuild:
name: 🔧 Pre Build
runs-on: ${{ matrix.os }}
needs: environment
strategy:
matrix:
os: ['ubuntu-latest']
steps:
- uses: actions/checkout@v2
- name: 🔧 Installation of dependencies
run: yarn run install-build-dependencies && yarn install --frozen-lockfile
- name: 🔧 Installation of electron dependencies
working-directory: ${{ env.electron_folder }}
run: yarn install --frozen-lockfile
- name: 🌀 Updating android version
run: sed -i -e 's/versionName "0.0.0"/versionName "${{ needs.environment.outputs.package_version }}"/g' android/app/build.gradle
- name: 🌀 Updating electron version
working-directory: ${{ env.electron_folder }}
run: npm version ${{ needs.environment.outputs.package_version }}
- name: 🧠 Caching prebuild
uses: actions/cache@v2
id: prebuild-cache
with:
path: ./*
key: prebuild-${{ runner.os }}-${{ github.sha }}
build_electron:
name: 🏗️ Build to Electron And Sync
runs-on: ${{ matrix.os }}
needs: [environment, prebuild]
strategy:
matrix:
os: ['ubuntu-latest']
steps:
- name: 🧠 Using prebuild cache
uses: actions/cache@v2
id: prebuild-cache
with:
path: ./*
key: prebuild-${{ runner.os }}-${{ github.sha }}
- name: 🏗️ Build
run: yarn run build:electron:prod
- name: 🔄 Copy to Electron
run: npx cap sync electron
- name: 🧠 Caching build
uses: actions/cache@v2
id: build-electron-cache
with:
path: ./*
key: electron-${{ runner.os }}-${{ github.sha }}
build_ionic:
name: 🏗️ Build Ionic
runs-on: ubuntu-latest
needs: [environment, prebuild]
steps:
- name: 🧠 Using prebuild cache
uses: actions/cache@v2
id: prebuild-cache
with:
path: ./*
key: prebuild-${{ runner.os }}-${{ github.sha }}
- name: 🔧 Prepare prod build
run: yarn run prepare-prod-build
- name: 🔧 Apply diagnostic modules
run: yarn run apply-diagnostic-modules
- name: 🏗️ Build
run: npx ionic build --prod
- name: 🔄 Copy to iOS
run: npx cap sync ios
- name: 🔄 Copy to Android
run: npx cap sync android
- name: 🧠 Caching build
uses: actions/cache@v2
id: build-ionic-cache
with:
path: ./*
key: ionic-${{ runner.os }}-${{ github.sha }}
# Desktop
build_windows:
name: 🏗️ Build to Windows
runs-on: ubuntu-latest
needs: [environment, build_electron]
steps:
- name: 🧠 Using build cache
uses: actions/cache@v2
id: build-electron-cache
with:
path: ./*
key: electron-${{ runner.os }}-${{ github.sha }}
- name: 🍷 Setup Wine
run: |
sudo dpkg --add-architecture i386
sudo apt update
wget -qO- https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt install software-properties-common
sudo apt-add-repository 'deb http://dl.winehq.org/wine-builds/ubuntu/ bionic main'
wget -qO- https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/Release.key | sudo apt-key add -
sudo sh -c 'echo "deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./" > /etc/apt/sources.list.d/obs.list'
sudo apt update
sudo apt-get install --install-recommends winehq-stable
- name: 🏗️ Build Windows
working-directory: ${{ env.electron_folder }}
run: yarn run build:windows
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v2
with:
name: '${{ needs.environment.outputs.app_name }} Windows ${{ needs.environment.outputs.package_version }}'
path: |
${{ env.electron_folder }}/build/${{ needs.environment.outputs.package_name }}-${{ needs.environment.outputs.package_version }}.exe
${{ env.electron_folder }}/build/${{ needs.environment.outputs.package_name }}-${{ needs.environment.outputs.package_version }}.exe.blockmap
build_mac:
name: 🏗️ Build to MacOS
runs-on: macos-latest
needs: [environment, build_electron]
steps:
- name: 🧠 Using build cache
uses: actions/cache@v2
id: build-electron-cache
with:
path: ./*
key: electron-Linux-${{ github.sha }}
- name: 🏗️ Build Mac
working-directory: ${{ env.electron_folder }}
run: yarn run build:mac
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v2
with:
name: '${{ needs.environment.outputs.app_name }} MacOS ${{ needs.environment.outputs.package_version }}'
path: |
${{ env.electron_folder }}/build/${{ needs.environment.outputs.package_name }}-${{ needs.environment.outputs.package_version }}.dmg
${{ env.electron_folder }}/build/${{ needs.environment.outputs.package_name }}-${{ needs.environment.outputs.package_version }}.dmg.blockmap
${{ env.electron_folder }}/build/${{ needs.environment.outputs.package_name }}-${{ needs.environment.outputs.package_version }}.zip
build_linux:
name: 🏗️ Build to Linux
runs-on: ubuntu-latest
needs: [environment, build_electron]
steps:
- name: 🧠 Using build cache
uses: actions/cache@v2
id: build-electron-cache
with:
path: ./*
key: electron-${{ runner.os }}-${{ github.sha }}
- name: 🏗️ Build Linux
working-directory: ${{ env.electron_folder }}
run: yarn run build:linux
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v2
with:
name: '${{ needs.environment.outputs.app_name }} Linux ${{ needs.environment.outputs.package_version }}'
path: ${{ env.electron_folder }}/build/${{ needs.environment.outputs.package_name }}-${{ needs.environment.outputs.package_version }}.AppImage
# Mobile
build_android:
name: 🏗️ Build to Android
runs-on: ubuntu-latest
needs: [environment, build_ionic]
steps:
- name: 🧠 Using build cache
uses: actions/cache@v2
id: build-angular-cache
with:
path: ./*
key: ionic-${{ runner.os }}-${{ github.sha }}
- name: ⚙️ Setup Java
uses: actions/setup-java@v1
with:
java-version: '11'
- name: 🔨 Clean Project
run: android/gradlew --project-dir android clean build
- name: 🗂️ Move APK
run: mv android/app/build/outputs/apk/release/app-release-unsigned.apk ${{ needs.environment.outputs.package_name }}-release-unsigned-${{ needs.environment.outputs.package_version }}.apk
- name: 🗂️ Copy APK
run: cp ${{ needs.environment.outputs.package_name }}-release-unsigned-${{ needs.environment.outputs.package_version }}.apk ${{ needs.environment.outputs.package_name }}-debug-${{ needs.environment.outputs.package_version }}.apk
- name: 🔐 Sign
run: jarsigner -verbose -keystore ./build/android/debug.keystore -storepass android -keypass android ${{ needs.environment.outputs.package_name }}-debug-${{ needs.environment.outputs.package_version }}.apk androiddebugkey
- name: 📦 Upload Artifact
uses: actions/upload-artifact@v2
with:
name: '${{ needs.environment.outputs.app_name }} Android ${{ needs.environment.outputs.package_version }}'
path: |
${{ needs.environment.outputs.package_name }}-release-unsigned-${{ needs.environment.outputs.package_version }}.apk
${{ needs.environment.outputs.package_name }}-debug-${{ needs.environment.outputs.package_version }}.apk
build_ios:
name: 🏗️ Build to iOS
runs-on: macos-latest
needs: [environment, build_ionic]
steps:
- name: 🧠 Using build cache
uses: actions/cache@v2
id: build-angular-cache
with:
path: ./*
key: ionic-Linux-${{ github.sha }}
# - name: 🔨 Xcode Task
# run: xcodebuild -workspace ios/App/App.xcworkspace -scheme "App" -destination generic/platform=iOS -configuration Release archive -archivePath ios/App.xcarchive MARKETING_VERSION=${{ needs.environment.outputs.package_version }} CURRENT_PROJECT_VERSION=${{ needs.environment.outputs.package_version }} -allowProvisioningUpdates
# - name: 🔨 Xcode Task
# run: xcodebuild -exportArchive -archivePath ios/App.xcarchive -exportOptionsPlist exportOptions.plist -exportPath ios/ -allowProvisioningUpdates
# - name: 📦 Upload Artifact
# uses: actions/upload-artifact@v2
# with:
# name: '${{ needs.environment.outputs.app_name }} iOS ${{ needs.environment.outputs.package_version }}'
# path: |
# ios/App.ipa
# ios/App.xcarchive