-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (167 loc) · 5.55 KB
/
release.yml
File metadata and controls
174 lines (167 loc) · 5.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
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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm run typecheck
- run: pnpm run test
release-windows:
runs-on: windows-latest
needs: validate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Cache electron
uses: actions/cache@v4
with:
path: |
~/.cache/electron
~/.cache/electron-builder
~\AppData\Local\electron\cache
~\AppData\Local\electron-builder\cache
key: electron-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
electron-cache-${{ runner.os }}-
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- name: Package (code signing)
run: pnpm run package
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
- name: Generate checksums
shell: pwsh
run: |
Get-ChildItem -Path release -Recurse -Include *.exe | ForEach-Object {
$hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()
"$hash $($_.Name)" | Out-File -Append -FilePath release/checksums-windows.txt
}
- uses: actions/upload-artifact@v4
with:
name: windows-release
path: |
release/**/*.exe
release/checksums-windows.txt
retention-days: 1
release-macos:
runs-on: macos-latest
needs: validate
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Cache electron
uses: actions/cache@v4
with:
path: |
~/.cache/electron
~/.cache/electron-builder
key: electron-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
electron-cache-${{ runner.os }}-
- run: pnpm install --frozen-lockfile
- run: pnpm run build
- name: Package (code signing & notarization)
run: |
if [ -n "$APPLE_ID" ] && [ -n "$APPLE_APP_SPECIFIC_PASSWORD" ] && [ -n "$APPLE_TEAM_ID" ]; then
echo "Notarization secrets found, enabling notarize"
npx json -I -f electron-builder.json -e 'this.mac.notarize=true'
fi
pnpm run package
env:
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Generate checksums
run: |
cd release
find . -name "*.dmg" -o -name "*.zip" | while read f; do
shasum -a 256 "$f" >> checksums-macos.txt
done
- uses: actions/upload-artifact@v4
with:
name: macos-release
path: |
release/**/*.dmg
release/**/*.zip
release/checksums-macos.txt
retention-days: 1
publish:
runs-on: ubuntu-latest
needs: [release-windows, release-macos]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: windows-release
path: artifacts/windows
- uses: actions/download-artifact@v4
with:
name: macos-release
path: artifacts/macos
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
echo "## Changes" > changelog.md
echo "" >> changelog.md
git log --pretty=format:"- %s (%h)" "$PREV_TAG"..HEAD >> changelog.md
echo "" >> changelog.md
echo "" >> changelog.md
echo "## Checksums" >> changelog.md
echo '```' >> changelog.md
cat artifacts/windows/checksums-windows.txt 2>/dev/null >> changelog.md || true
cat artifacts/macos/checksums-macos.txt 2>/dev/null >> changelog.md || true
echo '```' >> changelog.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: changelog.md
draft: false
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
files: |
artifacts/windows/**/*.exe
artifacts/macos/**/*.dmg
artifacts/macos/**/*.zip
artifacts/windows/checksums-windows.txt
artifacts/macos/checksums-macos.txt