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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
|
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# Note: This workflow requires some secrets setup, and set on this repo with the names:
# 'FERDI_PUBLISH_TOKEN' (A GitHub Personal Access Token with appropriate permissions - for publishing the built artifacts)
# 'APPLEID' (The username of your Apple developer account - for notarizing the mac artifacts)
# 'APPLEID_PASSWORD' (An app-specific password - for notarizing the mac artifacts)
# 'CSC_LINK' (The HTTPS link or local path to certificate - for code signing of mac and windows artifacts)
# 'CSC_KEY_PASSWORD' (The password to decrypt the certificate given in CSC_LINK - for code signing of mac and windows artifacts)
name: Ferdi Builds
on:
# Push to any tracked branches
push:
branches: [develop, release, nightly]
# PRs only on develop branch
pull_request:
branches: [develop]
# Manual trigger from the UI
workflow_dispatch:
inputs:
message:
description: 'Message for build'
required: true
schedule:
- cron: '0 0 * * *' # every night at 12 am
env:
USE_HARD_LINKS: false
# DEBUG: electron-builder
jobs:
check_updates:
runs-on: ubuntu-latest
name: 'Check latest commit: ${{ github.event.inputs.message }}'
outputs:
should_run: ${{ steps.should_run.outputs.should_run }}
steps:
- name: Set env vars
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
run: |
echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
- name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled'
uses: actions/checkout@v2
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
with:
ref: nightly
submodules: recursive
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v2
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
env:
cache-name: cache-node-modules
with:
path: ${{ env.NPM_CACHE }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache electron modules
uses: actions/cache@v2
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
env:
cache-name: cache-electron-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_CACHE }}
- name: Cache electron-builder modules
uses: actions/cache@v2
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
env:
cache-name: cache-electron-builder-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_BUILDER_CACHE }}
- name: Use Node.js 14.16.1
uses: actions/setup-node@v2
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
with:
node-version: 14.16.1
- name: Uninstall locally and reinstall node-gyp globally
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
run: |
npm uninstall node-gyp
npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)"
- name: Install node dependencies recursively
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
run: npx lerna bootstrap
- name: Print latest commit
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
run: echo ${{ github.sha }}
- name: Setup git configs
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Merge from 'origin/develop' (continue if errored)
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
continue-on-error: true
run: git merge --no-ff --no-verify --commit -m "Merge remote-tracking branch 'origin/develop' into HEAD" origin/develop
- name: Update submodules (continue if errored)
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
continue-on-error: true
run: |
echo "Updating submodules"
git submodule update --remote -f
git commit -am "Update submodules" --no-verify || true
echo "Running linter and tests"
npm run lint && npm run test
git commit -am "Apply linter fixes" --no-verify || true
echo "Updating browserslist db"
npx browserslist@latest --update-db
git commit -am "Apply browserslist data updates" --no-verify || true
- id: should_run
name: Check whether there are any commits since this run was last triggered and either push or set the output
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }}
run: |
CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l)
MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}"
echo "Number of changes: $CHANGES_COUNT"
if [ $CHANGES_COUNT -eq 0 ] && [ $MANUAL_REBUILD != "true" ]; then
echo "No changes found - terminating the build"
echo "::set-output name=should_run::false"
else
# changes > 0 (or) MANUAL_REBUILD=true
if [ $MANUAL_REBUILD != "true" ] || [ "${{ contains(github.event.inputs.message, 'version bump') }}" == "true" ]; then
echo "Bumping version number"
npm version prerelease --preid=nightly
fi
echo "Pushing merge, linter, submodule and version-bump commits"
git push origin nightly --no-verify
fi
build_mac:
name: 'macos ${{ github.event.inputs.message }}'
needs: check_updates
if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'macOS') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }}
runs-on: macos-10.15
steps:
- name: Set env vars
run: |
echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV
- name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch
uses: actions/checkout@v2
if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }}
with:
submodules: recursive
ref: nightly
fetch-depth: 0
- name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch
uses: actions/checkout@v2
if: ${{ github.event_name != 'schedule' && env.MANUAL_REBUILD_ON_NIGHTLY != 'true' }}
with:
submodules: recursive
fetch-depth: 0
- name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
shell: bash
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ${{ env.NPM_CACHE }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache electron modules
uses: actions/cache@v2
env:
cache-name: cache-electron-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_CACHE }}
- name: Cache electron-builder modules
uses: actions/cache@v2
env:
cache-name: cache-electron-builder-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_BUILDER_CACHE }}
- name: Use Node.js 14.16.1
uses: actions/setup-node@v2
with:
node-version: 14.16.1
- name: Upgrade Xcode version on the macOS 10.15 default runners provided by GH Actions
run: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
sudo xcode-select -s "/Applications/Xcode_12.4.app"
- name: Uninstall locally and reinstall node-gyp globally
run: |
npm uninstall node-gyp
npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)"
- name: Install node dependencies recursively
run: npx lerna bootstrap
- name: Package recipes
run: npm i && npm run package
working-directory: ./recipes
- name: Run linter and tests
run: npm run lint && npm run test
- name: Build Ferdi without publish for any branch not 'nightly' and not 'release'
if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
run: npm run build -- --publish never
shell: bash
- name: Build Ferdi with publish for 'nightly' branch
if: ${{ env.GIT_BRANCH_NAME == 'nightly' }}
run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies
shell: bash
env:
GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
APPLEID: ${{ secrets.APPLEID }}
APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
- name: Build Ferdi with publish for 'release' branch
if: ${{ env.GIT_BRANCH_NAME == 'release' }}
run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi
shell: bash
env:
GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
APPLEID: ${{ secrets.APPLEID }}
APPLEID_PASSWORD: ${{ secrets.APPLEID_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
build_linux:
name: 'ubuntu ${{ github.event.inputs.message }}'
needs: check_updates
if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'Linux') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }}
runs-on: ubuntu-20.04
steps:
- name: Set env vars
run: |
echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV
echo "ELECTRON_CACHE=$HOME/.cache/electron" >> $GITHUB_ENV
echo "ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder" >> $GITHUB_ENV
echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV
- name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch
uses: actions/checkout@v2
if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }}
with:
submodules: recursive
ref: nightly
fetch-depth: 0
- name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch
uses: actions/checkout@v2
if: ${{ github.event_name != 'schedule' && env.MANUAL_REBUILD_ON_NIGHTLY != 'true' }}
with:
submodules: recursive
fetch-depth: 0
- name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
shell: bash
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ${{ env.NPM_CACHE }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache electron modules
uses: actions/cache@v2
env:
cache-name: cache-electron-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_CACHE }}
- name: Cache electron-builder modules
uses: actions/cache@v2
env:
cache-name: cache-electron-builder-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_BUILDER_CACHE }}
- name: Use Node.js 14.16.1
uses: actions/setup-node@v2
with:
node-version: 14.16.1
- name: Uninstall locally and reinstall node-gyp globally
run: |
npm uninstall node-gyp
npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)"
- name: Install node dependencies recursively
run: npx lerna bootstrap
- name: Package recipes
run: npm i && npm run package
working-directory: ./recipes
- name: Run linter and tests
run: npm run lint && npm run test
- name: Build Ferdi without publish for any branch not 'nightly' and not 'release'
if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
run: npm run build -- --publish never
shell: bash
- name: Build Ferdi with publish for 'nightly' branch
if: ${{ env.GIT_BRANCH_NAME == 'nightly' }}
run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies
shell: bash
env:
GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: Build Ferdi with publish for 'release' branch
if: ${{ env.GIT_BRANCH_NAME == 'release' }}
run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi
shell: bash
env:
GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
build_windows:
name: 'windows ${{ github.event.inputs.message }}'
needs: check_updates
if: ${{ (needs.check_updates.outputs.should_run != 'false') && (github.event_name != 'workflow_dispatch' || (github.event_name == 'workflow_dispatch' && (contains(github.event.inputs.message, 'Windows') || (!contains(github.event.inputs.message, 'macOS') && !contains(github.event.inputs.message, 'Linux') && !contains(github.event.inputs.message, 'Windows'))))) }}
runs-on: windows-2019
steps:
- name: Set env vars
run: |
echo "HOME=$USERPROFILE" >> $GITHUB_ENV
echo "NPM_CACHE=$USERPROFILE\.npm" >> $GITHUB_ENV
echo "ELECTRON_CACHE=$USERPROFILE\.cache\electron" >> $GITHUB_ENV
echo "ELECTRON_BUILDER_CACHE=$USERPROFILE\.cache\electron-builder" >> $GITHUB_ENV
echo "MANUAL_REBUILD_ON_NIGHTLY=${{ github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch') }}" >> $GITHUB_ENV
echo "SKIP_NOTARIZATION=${{ !contains(github.repository_owner, 'getferdi') }}" >> $GITHUB_ENV
shell: bash
- name: Checkout code along with submodules for the 'nightly' branch if the trigger event is 'scheduled' or this is a forced rebuild on the nightly branch
uses: actions/checkout@v2
if: ${{ github.event_name == 'schedule' || env.MANUAL_REBUILD_ON_NIGHTLY == 'true' }}
with:
submodules: recursive
ref: nightly
fetch-depth: 0
- name: Checkout code along with submodules for any branch if the trigger event is NOT 'scheduled' and this is NOT a forced rebuild on the nightly branch
uses: actions/checkout@v2
if: ${{ github.event_name != 'schedule' && env.MANUAL_REBUILD_ON_NIGHTLY != 'true' }}
with:
submodules: recursive
fetch-depth: 0
- name: Extract Git branch name from the currently checked out branch (not from the branch where this run was kicked off)
run: echo "GIT_BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
shell: bash
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ${{ env.NPM_CACHE }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache electron modules
uses: actions/cache@v2
env:
cache-name: cache-electron-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_CACHE }}
- name: Cache electron-builder modules
uses: actions/cache@v2
env:
cache-name: cache-electron-builder-modules
with:
key: ${{ runner.os }}-${{ env.cache-name }}
path: ${{ env.ELECTRON_BUILDER_CACHE }}
- name: Use Node.js 14.16.1
uses: actions/setup-node@v2
with:
node-version: 14.16.1
- name: Install node dependencies recursively
run: npx lerna bootstrap
- name: Package recipes
run: npm i && npm run package
working-directory: ./recipes
- name: Run linter and tests
run: npm run lint && npm run test
- name: Build Ferdi without publish for any branch not 'nightly' and not 'release'
if: ${{ env.GIT_BRANCH_NAME != 'nightly' && env.GIT_BRANCH_NAME != 'release' }}
run: npm run build -- --publish never
shell: bash
- name: Build Ferdi with publish for 'nightly' branch
if: ${{ env.GIT_BRANCH_NAME == 'nightly' }}
run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=nightlies
shell: bash
env:
GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
# TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing)
# WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
# WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
- name: Build Ferdi with publish for 'release' branch
if: ${{ env.GIT_BRANCH_NAME == 'release' }}
run: npm run build -- --publish always -c.publish.provider=github -c.publish.owner=${{ github.repository_owner }} -c.publish.repo=ferdi
shell: bash
env:
GH_TOKEN: ${{ secrets.FERDI_PUBLISH_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
# TODO: Commented out the code signing process for now (so as to at least get unsigned nightlies available for testing)
# WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
# WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
|