-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
410 lines (356 loc) · 14.2 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
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
name: Package-Build
on: [push, pull_request]
jobs:
Lint:
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Installing Node
uses: actions/[email protected]
with:
node-version: 16
- name: Install deps
run: |
npm i -g [email protected]
cd app
yarn
cd ..
rm app/node_modules/.yarn-integrity
yarn
- name: Build typings
run: yarn run build:typings
- name: Lint
run: yarn run lint
macOS-Build:
runs-on: macos-11
needs: Lint
strategy:
matrix:
include:
- arch: x86_64
- arch: arm64
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Installing Node
uses: actions/[email protected]
with:
node-version: 16
- name: Install deps
run: |
sudo npm i -g [email protected]
yarn --network-timeout 1000000
env:
ARCH: ${{matrix.arch}}
- name: Fix cross build
run: |
rm -rf app/node_modules/cpu-features
rm -rf app/node_modules/ssh2/crypto/build
if: matrix.arch == 'arm64'
- name: Webpack
run: yarn run build
- name: Prepackage plugins
run: scripts/prepackage-plugins.mjs
env:
ARCH: ${{matrix.arch}}
- run: sed -i '' 's/updateInfo = await/\/\/updateInfo = await/g' node_modules/app-builder-lib/out/targets/ArchiveTarget.js
# Work around electron-builder beta bug
- run: ln -s ../../node_modules/electron app/node_modules
- name: Build and sign packages
run: scripts/build-macos.mjs
if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
env:
ARCH: ${{matrix.arch}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPSTORE_USERNAME: ${{ secrets.APPSTORE_USERNAME }}
APPSTORE_PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
USE_HARD_LINKS: false
# DEBUG: electron-builder,electron-builder:*
- name: Build packages without signing
run: scripts/build-macos.mjs
if: "! (github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
env:
ARCH: ${{matrix.arch}}
# DEBUG: electron-builder,electron-builder:*
- name: Upload symbols
run: |
sudo npm install -g @sentry/cli --unsafe-perm
./scripts/sentry-upload.mjs
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Package artifacts
run: |
mkdir artifact-dmg
mv dist/*.dmg artifact-dmg/
mkdir artifact-zip
mv dist/*.zip artifact-zip/
- uses: actions/upload-artifact@master
name: Upload DMG
with:
name: macOS .dmg (${{matrix.arch}})
path: artifact-dmg
- uses: actions/upload-artifact@master
name: Upload ZIP
with:
name: macOS .zip (${{matrix.arch}})
path: artifact-zip
Linux-Build:
runs-on: ubuntu-20.04
needs: Lint
strategy:
matrix:
include:
- build-arch: x64
arch: amd64
- build-arch: arm64
arch: arm64
triplet: aarch64-linux-gnu-
- build-arch: arm
arch: armhf
triplet: arm-linux-gnueabihf-
env:
CC: ${{matrix.triplet}}gcc
CXX: ${{matrix.triplet}}g++
ARCH: ${{matrix.build-arch}}
npm_config_arch: ${{matrix.build-arch}}
npm_config_target_arch: ${{matrix.build-arch}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Node
uses: actions/[email protected]
with:
node-version: 18
- name: Install deps (amd64)
run: |
sudo apt-get update
sudo apt-get install libarchive-tools zsh
- name: Install npm_modules (amd64)
run: |
npm i -g yarn
yarn --network-timeout 1000000
if: matrix.build-arch == 'x64'
- name: Setup Crossbuild (${{matrix.arch}})
run: |
sudo apt-get update -y && sudo apt-get install schroot sbuild debootstrap -y
sudo debootstrap --include=git,curl,gnupg,ca-certificates,crossbuild-essential-${{matrix.arch}},python-dev,python3-dev,libarchive-tools,cmake --variant=buildd --exclude=snapd --components=main,restricted,universe,multiverse --extractor=dpkg-deb bionic /build-chroot/
echo 'deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse' | sudo tee /build-chroot/etc/apt/sources.list >/dev/null
echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ubuntu-ports bionic main restricted universe multiverse' | sudo tee -a /build-chroot/etc/apt/sources.list >/dev/null
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | sudo tee /build-chroot/etc/apt/trusted.gpg.d/nodesource.gpg >/dev/null
echo 'deb http://deb.nodesource.com/node_16.x bionic main' | sudo tee /build-chroot/etc/apt/sources.list.d/nodesource.list >/dev/null
echo "[build-chroot]
description=Ubuntu 18.04 Build chroot
type=directory
directory=/build-chroot
root-groups=root,sudo
profile=buildd
personality=linux
union-type=overlay" | sudo tee /etc/schroot/chroot.d/build-chroot.pref >/dev/null
echo "/home /home none rw,bind 0 0" | sudo tee -a /etc/schroot/buildd/fstab >/dev/null
if: matrix.build-arch != 'x64'
- name: Install node_modules & CrossBuild native modules for ${{matrix.arch}}
run: |
sudo schroot -c build-chroot -u root -- bash -c "apt-get update -y
dpkg --add-architecture ${{matrix.arch}}
apt-get install -y nodejs libfontconfig-dev:${{matrix.arch}} libsecret-1-dev:${{matrix.arch}} libnss3:${{matrix.arch}} libatk1.0-0:${{matrix.arch}} libatk-bridge2.0-0:${{matrix.arch}} libgdk-pixbuf2.0-0:${{matrix.arch}} libgtk-3-0:${{matrix.arch}} libgbm1:${{matrix.arch}}
export CC=${{matrix.triplet}}gcc CXX=${{matrix.triplet}}g++ LD=${{matrix.triplet}}ld
if [[ ${{matrix.arch}} == 'arm64' ]]; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/aarch64-linux-gnu/pkgconfig/
elif [[ ${{matrix.arch}} == 'armhf' ]]; then
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/arm-linux-gnueabihf/pkgconfig/
fi
export ARCH=${{matrix.build-arch}} npm_config_arch=${{matrix.build-arch}} npm_config_target_arch=${{matrix.build-arch}}
npm i -g yarn
yarn --network-timeout 1000000 --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}"
if: matrix.build-arch != 'x64'
- name: Webpack (${{matrix.arch}})
run: yarn run build --arch=${{matrix.build-arch}} --target_arch=${{matrix.build-arch}}
- name: Prepackage plugins (${{matrix.arch}})
run: scripts/prepackage-plugins.mjs
- name: Build packages (${{matrix.arch}})
run: scripts/build-linux.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
USE_HARD_LINKS: false
# DEBUG: electron-builder,electron-builder:*
- name: Build web resources
run: zsh -c 'tar czf tabby-web.tar.gz (tabby-*|web)/dist'
if: matrix.build-arch == 'x64'
# - name: Install deps and Build (arm64)
# uses: docker://multiarch/ubuntu-core:arm64-bionic
# with:
# args: >
# bash -c
# "apt update && apt install curl lsb-release gnupg -y &&
# curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
# apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
# git config --global --add safe.directory /github/workspace &&
# gem install public_suffix -v 4.0.7 &&
# gem install fpm --no-document &&
# npm i -g yarn &&
# cd /github/workspace &&
# yarn --network-timeout 1000000 &&
# yarn run build &&
# scripts/prepackage-plugins.mjs &&
# USE_SYSTEM_FPM=true scripts/build-linux.mjs"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
# USE_HARD_LINKS: false
# if: matrix.build-arch == 'arm64' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
# - name: Install deps and Build (armv7l)
# uses: docker://multiarch/ubuntu-core:armhf-bionic
# with:
# args: >
# bash -c
# "apt update && apt install curl lsb-release gnupg -y &&
# curl -fsSL https://deb.nodesource.com/setup_16.x | bash - &&
# apt install make build-essential git ruby libarchive-tools nodejs rpm libsecret-1-dev libfontconfig1-dev -y &&
# git config --global --add safe.directory /github/workspace &&
# gem install public_suffix -v 4.0.7 &&
# gem install fpm --no-document &&
# npm i -g yarn &&
# cd /github/workspace &&
# sed -i '/ \"electron\":/c\ \"electron\": \"17.0.0\",' package.json &&
# yarn --network-timeout 1000000 &&
# yarn run build &&
# scripts/prepackage-plugins.mjs &&
# USE_SYSTEM_FPM=true scripts/build-linux.mjs"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
# USE_HARD_LINKS: false
# if: matrix.build-arch == 'arm' && github.repository == 'Eugeny/tabby' && startsWith(github.ref, 'refs/tags')
- name: Upload symbols (amd64 only)
run: |
sudo npm install -g @sentry/cli --unsafe-perm
./scripts/sentry-upload.mjs
if: matrix.build-arch == 'x64'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Upload packages to packagecloud.io
uses: Eugeny/packagecloud-action@main
if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
with:
repo: 'eugeny/tabby'
dir: 'dist'
- uses: actions/upload-artifact@master
name: Upload AppImage (${{matrix.arch}})
with:
name: Linux AppImage (${{matrix.arch}})
path: dist/*.AppImage
- uses: actions/upload-artifact@master
name: Upload DEB (${{matrix.arch}})
with:
name: Linux DEB (${{matrix.arch}})
path: dist/*.deb
- uses: actions/upload-artifact@master
name: Upload RPM (${{matrix.arch}})
with:
name: Linux RPM (${{matrix.arch}})
path: dist/*.rpm
- uses: actions/upload-artifact@master
name: Upload Pacman Package (${{matrix.arch}})
with:
name: Linux Pacman (${{matrix.arch}})
path: dist/*.pacman
- uses: actions/upload-artifact@master
name: Upload Linux tarball (${{matrix.arch}})
with:
name: Linux tarball (${{matrix.arch}})
path: dist/*.tar.gz
- uses: actions/upload-artifact@master
name: Upload web tarball (amd64 only)
with:
name: Web tarball
path: tabby-web.tar.gz
if: matrix.build-arch == 'x64'
Windows-Build:
runs-on: windows-2022
needs: Lint
strategy:
matrix:
include:
- arch: x64
- arch: arm64
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Installing Node
uses: actions/[email protected]
with:
node-version: 16
- name: Update node-gyp
run: |
npm install --global [email protected]
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: Build
shell: powershell
run: |
npm i -g [email protected]
yarn --network-timeout 1000000
yarn run build
node scripts/prepackage-plugins.mjs
env:
ARCH: ${{matrix.arch}}
- name: Build and sign packages
run: node scripts/build-windows.mjs
if: github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags'))
env:
ARCH: ${{matrix.arch}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KEYGEN_TOKEN: ${{ secrets.KEYGEN_TOKEN }}
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
DEBUG: electron-builder,electron-builder:*
- name: Build packages without signing
run: node scripts/build-windows.mjs
if: "!(github.repository == 'Eugeny/tabby' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags')))"
env:
ARCH: ${{matrix.arch}}
- name: Upload symbols
run: |
npm install @sentry/cli
node scripts/sentry-upload.mjs
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: Package artifacts
run: |
mkdir artifact-setup
mv dist/*-setup-*.exe artifact-setup/
mkdir artifact-portable
mv dist/*-portable-*.zip artifact-portable/
- uses: actions/upload-artifact@master
name: Upload installer
with:
name: Windows installer (${{matrix.arch}})
path: artifact-setup
- uses: actions/upload-artifact@master
name: Upload portable build
with:
name: Windows portable build (${{matrix.arch}})
path: artifact-portable