-
Notifications
You must be signed in to change notification settings - Fork 236
79 lines (79 loc) · 2.98 KB
/
ci.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
name: CI build
on:
workflow_dispatch:
pull_request:
push:
permissions:
contents: read
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-latest] # [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- run: node --version && npm --version
- run: npm ci
- run: npm run test
- if: runner.os == 'Windows'
run: echo "Import CI context"
- if: runner.os == 'Windows'
run: echo "Add CSC to machine store"
- if: runner.os == 'macOS'
run: fastlane circleci
- name: Work around electron-userland/electron-builder#4964
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
brew install go go-bindata
git -C ~ clone https://github.com/develar/app-builder.git
git -C ~/app-builder checkout b85740334fec875f5dd8dcd22eb1f729599109db
make --directory=~/app-builder build
ln -sfv ~/app-builder/dist/app-builder_darwin_amd64/app-builder ./node_modules/app-builder-bin/mac/
- name: Build
env:
# let Windows know where to get the PFX (ignored on non-Windows builds)
WIN_CSC_LINK: ~/codesign.pfx
# blank CIRCLE_BUILD_NUM to work around electron-userland/electron-builder#5016
CIRCLE_BUILD_NUM: ""
# increased Node memory needed for macOS build
NODE_OPTIONS: --max-old-space-size=4096
run: |
npm run distDev
- name: Create Artifacts directory
shell: bash
run: mkdir -p Artifacts
- name: Move DMG to Artifacts
if: runner.os == 'macOS'
run: mv -v dist/Scratch*.dmg Artifacts/
- name: Move PKG to Artifacts
if: runner.os == 'macOS' # TODO: only if signed
run: mv -v dist/Scratch*.pkg Artifacts/
- name: Zip MAS-Dev build
if: runner.os == 'macOS' # TODO: only if signed
# If you use `zip` for this it will throw away some metadata (resource forks?) and
# the app will crash on startup with "EXC_CRASH (Code Signature Invalid)".
# To preserve that metadata, use `ditto` instead.
# See also: https://stackoverflow.com/a/22370486
run: |
NPM_APP_VERSION="`node -pe "require('./package.json').version"`"
cd dist/mas-dev
ditto -v -c -k --sequesterRsrc --keepParent --zlibCompressionLevel 9 \
Scratch*.app ../../Artifacts/mas-dev-${NPM_APP_VERSION}.zip
- name: Move Windows build products to Artifacts
if: runner.os == 'Windows'
shell: bash
run: mv -v dist/{Scratch*.appx,Scratch*.exe} Artifacts/
- uses: actions/upload-artifact@v3
with:
path: Artifacts/*