-
Notifications
You must be signed in to change notification settings - Fork 52
92 lines (86 loc) · 3.56 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
name: Build
on:
push:
pull_request:
jobs:
format:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
- name: Install Node.js dependencies
run: npm ci
- name: Check formatting
run: npm run check-format
build:
strategy:
matrix:
platform:
- { displayName: "macOS", os: macos-latest, shortName: "mac", buildArg: "-m", artifactExt: "dmg" }
- { displayName: "Windows", os: windows-latest, shortName: "win", buildArg: "-w", artifactExt: "exe" }
- { displayName: "Linux/deb", os: ubuntu-latest, shortName: "linux", buildArg: "-l deb", artifactExt: "deb" }
- {
displayName: "Linux/snap",
os: ubuntu-latest,
shortName: "linux",
buildArg: "-l snap",
artifactExt: "snap"
}
- {
displayName: "Linux/AppImage",
os: ubuntu-latest,
shortName: "linux",
buildArg: "-l AppImage",
artifactExt: "AppImage"
}
arch: ["x64", "arm64"]
exclude:
- arch: arm64
platform: { displayName: "Linux/snap", os: ubuntu-latest, shortName: "linux", artifactExt: "snap" }
name: Build for ${{ matrix.platform.displayName }} (${{ matrix.arch }})
runs-on: ${{ matrix.platform.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
cache: "npm"
- name: Install Node.js dependencies
run: npm ci
- name: Install Linux dependencies
if: matrix.platform.os == 'ubuntu-latest'
run: sudo apt-get update; sudo apt-get install --no-install-recommends -y libarchive-tools snapcraft
- name: Prepare macOS certificate
if: matrix.platform.os == 'macos-latest' && github.event_name == 'push'
run: |
echo "CSC_LINK=${{ secrets.MACOS_CERTIFICATE }}" >> $GITHUB_ENV
echo "CSC_KEY_PASSWORD=${{ secrets.MACOS_CERTIFICATE_PWD }}" >> $GITHUB_ENV
- name: Build app
run: npm run build -- --${{ matrix.arch }} ${{ matrix.platform.buildArg }} --publish never
env:
NODE_OPTIONS: --max-old-space-size=4096
- name: Prepare macOS artifact
if: matrix.platform.os == 'macos-latest'
run: |
mv dist/AdvantageScope-*.dmg advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}
- name: Prepare Linux artifact
if: matrix.platform.os == 'ubuntu-latest'
run: |
mv dist/*.${{ matrix.platform.artifactExt }} advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}
- name: Prepare Windows artifact
if: matrix.platform.os == 'windows-latest'
run: |
Move-Item -Path "dist\AdvantageScope*.exe" -Destination "advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}
path: advantagescope-${{ matrix.platform.shortName }}-${{ matrix.arch }}-dev.${{ matrix.platform.artifactExt }}