-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (113 loc) · 4.55 KB
/
Copy pathrelease.yml
File metadata and controls
128 lines (113 loc) · 4.55 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
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
name: Release
# Build installers for every platform and publish them to a GitHub Release
# whenever a v* tag is pushed. Run manually (workflow_dispatch) to dry-build
# without publishing.
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
args: --mac
- os: windows-latest
args: --win
- os: ubuntu-latest
args: --linux
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
# node-gyp (used to rebuild native node-pty) imports distutils, which was
# removed in Python 3.12. Pin 3.11 and install setuptools so the distutils
# shim is available across all runners.
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Provide distutils for node-gyp
run: python -m pip install --upgrade setuptools
- name: Install dependencies
run: npm ci
- name: Compile (electron-vite → out/)
run: npm run build
- name: Package installers
# GH_TOKEN lets electron-builder skip its own publish; we upload via the
# release step below for full control over the asset set.
run: npx electron-builder ${{ matrix.args }} --publish never
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# macOS code signing + notarization — MUST be macOS-only. CSC_LINK is the
# Apple Developer ID .p12; if it leaks into the Windows/Linux runners,
# electron-builder tries to sign those targets with the mac cert and the
# build hard-fails ("cannot extract publisher name"). So gate on the OS.
# APPLE_CERTIFICATE_P12 = base64 of the "Developer ID Application" .p12
# APPLE_CERTIFICATE_PASSWORD = that .p12's export password (REQUIRED if P12 set,
# else electron-builder imports with an empty
# password and fails "MAC verification failed")
# All optional: with the secrets unset every runner builds unsigned and stays green.
CSC_LINK: ${{ matrix.os == 'macos-latest' && secrets.APPLE_CERTIFICATE_P12 || '' }}
CSC_KEY_PASSWORD: ${{ matrix.os == 'macos-latest' && secrets.APPLE_CERTIFICATE_PASSWORD || '' }}
APPLE_ID: ${{ matrix.os == 'macos-latest' && secrets.APPLE_ID || '' }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ matrix.os == 'macos-latest' && secrets.APPLE_APP_SPECIFIC_PASSWORD || '' }}
APPLE_TEAM_ID: ${{ matrix.os == 'macos-latest' && secrets.APPLE_TEAM_ID || '' }}
- name: Generate checksums
shell: bash
run: |
cd dist
# hash only the distributable artifacts, not blockmaps/yml
files=$(ls *.dmg *.exe *.AppImage 2>/dev/null || true)
[ -z "$files" ] && { echo "no artifacts to hash"; exit 0; }
if command -v sha256sum >/dev/null 2>&1; then
sha256sum $files > "SHA256SUMS-${{ matrix.os }}.txt"
else
shasum -a 256 $files > "SHA256SUMS-${{ matrix.os }}.txt"
fi
cat "SHA256SUMS-${{ matrix.os }}.txt"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-dist
path: |
dist/*.dmg
dist/*.exe
dist/*.AppImage
dist/SHA256SUMS-*.txt
if-no-files-found: warn
publish:
name: Publish release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Flatten + merge checksums
run: |
mkdir -p release
find artifacts -type f \( -name '*.dmg' -o -name '*.exe' -o -name '*.AppImage' \) -exec cp {} release/ \;
cat artifacts/*/SHA256SUMS-*.txt > release/SHA256SUMS.txt 2>/dev/null || true
ls -la release
- name: Publish to GitHub Release
uses: softprops/action-gh-release@v2
with:
# RELEASE.md is the human-facing notes; GitHub shows it as the body.
body_path: RELEASE.md
fail_on_unmatched_files: false
files: |
release/*.dmg
release/*.exe
release/*.AppImage
release/SHA256SUMS.txt