-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (78 loc) · 2.96 KB
/
Copy pathrelease.yml
File metadata and controls
90 lines (78 loc) · 2.96 KB
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
name: Release
# Fires when `npm run release` pushes a v* tag. Each platform builds on its own
# runner and uploads into the SAME draft GitHub Release (electron-builder keys
# the release off the version), so a partial matrix failure never publishes a
# half-complete update feed.
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux
os: ubuntu-latest
targets: --linux AppImage deb
- name: windows
os: windows-latest
targets: --win nsis portable
- name: macos
os: macos-latest
targets: --mac dmg zip
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
# xterm's peer range conflicts with the installed React major; this repo
# is installed with legacy peer resolution everywhere, CI included.
- name: Install
run: npm ci --legacy-peer-deps
# Several suites transitively import `electron`, and its index.js downloads
# the binary on first require. Parallel vitest workers racing that download
# corrupt the extract on macOS (EEXIST on the Electron Framework symlink),
# so do it once, serially, up front. Idempotent - exits early if present.
- name: Install Electron binary
shell: bash
run: |
for attempt in 1 2 3; do
npm run install-electron && exit 0
if [ "$attempt" -eq 3 ]; then exit 1; fi
echo "Electron download failed (attempt $attempt/3); retrying in 10 seconds..."
sleep 10
done
- name: Typecheck
run: npm run typecheck
# Tests load node-pty under Node.js, so they must run before the native
# addon is rebuilt for Electron's different ABI.
- name: Test
run: npm test
# package.json sets npmRebuild:false, so node-pty is NOT rebuilt for
# Electron's ABI automatically. Rebuild only after Node-based tests pass;
# otherwise macOS tests load the Electron-ABI addon and PTY output stalls.
- name: Rebuild native modules for Electron
run: npm run rebuild
# A tag like v0.2.0-nightly.1 must land as a GitHub *prerelease*, because
# that is exactly what the app's nightly channel filters on
# (autoUpdater.allowPrerelease). A stable tag must not be flagged.
- name: Classify release
shell: bash
run: |
if [[ "${GITHUB_REF_NAME}" == *-* ]]; then
echo "EP_PRE_RELEASE=true" >> "$GITHUB_ENV"
else
echo "EP_PRE_RELEASE=false" >> "$GITHUB_ENV"
fi
- name: Build and publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm run build && npx electron-builder ${{ matrix.targets }} --publish always