-
Notifications
You must be signed in to change notification settings - Fork 4
227 lines (219 loc) · 9.98 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
name: Build artifacts and attach to release
on:
release:
types: [published]
concurrency:
group: "build"
cancel-in-progress: true
jobs:
buildWindows:
name: Build windows artifacts and attach to release
runs-on: win11
permissions:
contents: write
env:
SIGN_TOKEN_ALIAS: ${{ secrets.SIGN_TOKEN_ALIAS }}
SIGN_TOKEN_PASS: ${{ secrets.SIGN_TOKEN_PASS }}
ELECTRON_BUILDER_CACHE: "C:\\actions-runner\\cache\\builder"
ELECTRON_BUILDER_DOWNLOAD_PATH: "C:\\actions-runner\\cache\\electron"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Clear builder cache
run: |
if (Test-Path "$env:ELECTRON_BUILDER_CACHE") {
Remove-Item -Recurse -Force "$env:ELECTRON_BUILDER_CACHE"
}
if (Test-Path "$env:ELECTRON_BUILDER_DOWNLOAD_PATH") {
Remove-Item -Recurse -Force "$env:ELECTRON_BUILDER_DOWNLOAD_PATH"
}
- name: Install dependencies
run: npm install --package-lock-only; npm ci
- name: Install prebuilts
run: npm install @parcel/watcher-win32-ia32@latest @parcel/watcher-win32-x64@latest @parcel/watcher-win32-arm64@latest --force
- name: Build
run: npm run build:win
env:
SIGN_TOKEN_ALIAS: ${{ secrets.SIGN_TOKEN_ALIAS }}
SIGN_TOKEN_PASS: ${{ secrets.SIGN_TOKEN_PASS }}
- name: Generate SHA256 hashes
run: |
Get-ChildItem prod -File | ForEach-Object {
$hash = CertUtil -hashfile $_.FullName SHA256 | Select-String -Pattern "^[0-9a-fA-F]{64}$"
$hash -replace "\s+", "" | Out-File "$($_.FullName).sha256.txt"
}
- name: Generate update hashes
run: npm run build:hashes
- name: Attach artifacts to release
uses: softprops/action-gh-release@v2
with:
files: |
prod/Filen_win.exe
prod/Filen_win.exe.sha256.txt
prod/Filen_win.exe.blockmap
prod/Filen_win.exe.blockmap.sha256.txt
prod/Filen_win_arm64.exe
prod/Filen_win_arm64.exe.sha256.txt
prod/Filen_win_arm64.exe.blockmap
prod/Filen_win_arm64.exe.blockmap.sha256.txt
prod/Filen_win_arm64.zip
prod/Filen_win_arm64.zip.sha256.txt
prod/Filen_win_x64.exe
prod/Filen_win_x64.exe.sha256.txt
prod/Filen_win_x64.exe.blockmap
prod/Filen_win_x64.exe.blockmap.sha256.txt
prod/Filen_win_x64.zip
prod/Filen_win_x64.zip.sha256.txt
prod/latest.yml
prod/latest.yml.sha256.txt
- name: Cleanup
run: npm run clear
buildLinux:
name: Build linux artifacts and attach to release
runs-on: ubuntu-latest
permissions:
contents: write
env:
ELECTRON_BUILDER_CACHE: "/tmp/electron-builder"
ELECTRON_BUILDER_DOWNLOAD_PATH: "/tmp/electron"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Clear builder cache
run: |
if [ -d "$ELECTRON_BUILDER_CACHE" ]; then
rm -rf $ELECTRON_BUILDER_CACHE
fi
if [ -d "$ELECTRON_BUILDER_DOWNLOAD_PATH" ]; then
rm -rf $ELECTRON_BUILDER_DOWNLOAD_PATH
fi
- name: Install dependencies
run: npm install --package-lock-only && npm ci
- name: Install prebuilts
run: npm install @parcel/watcher-linux-x64-glibc@latest @parcel/watcher-linux-x64-musl@latest @parcel/watcher-linux-arm64-musl@latest @parcel/watcher-linux-arm64-glibc@latest @parcel/watcher-linux-arm-glibc@latest @parcel/watcher-linux-arm-musl@latest --force
- name: Build
run: npm run build:linux
- name: Generate SHA256 hashes
run: |
for file in prod/*; do
if [ -f "$file" ]; then
sha256sum "$file" | awk '{print $1}' > "$file.sha256.txt"
fi
done
- name: Generate update hashes
run: npm run build:hashes
- name: Attach artifacts to release
uses: softprops/action-gh-release@v2
with:
files: |
prod/Filen_linux_aarch64.rpm
prod/Filen_linux_amd64.deb
prod/Filen_linux_arm64.AppImage
prod/Filen_linux_arm64.deb
prod/Filen_linux_arm64.zip
prod/Filen_linux_x64.zip
prod/Filen_linux_x86_64.AppImage
prod/Filen_linux_x86_64.rpm
prod/latest-linux-arm64.yml
prod/latest-linux.yml
prod/Filen_linux_aarch64.rpm.sha256.txt
prod/Filen_linux_amd64.deb.sha256.txt
prod/Filen_linux_arm64.AppImage.sha256.txt
prod/Filen_linux_arm64.deb.sha256.txt
prod/Filen_linux_arm64.zip.sha256.txt
prod/Filen_linux_x64.zip.sha256.txt
prod/Filen_linux_x86_64.AppImage.sha256.txt
prod/Filen_linux_x86_64.rpm.sha256.txt
prod/latest-linux-arm64.yml.sha256.txt
prod/latest-linux.yml.sha256.txt
- name: Cleanup
run: npm run clear
buildMac:
name: Build macOS artifacts and attach to release
runs-on: macos-latest
permissions:
contents: write
env:
APPLE_DEVELOPER_ID_CERT: ${{ secrets.APPLE_DEVELOPER_ID_CERT }}
APPLE_DEVELOPER_ID_CERT_PASS: ${{ secrets.APPLE_DEVELOPER_ID_CERT_PASS }}
APPLE_NOTARIZE_ID: ${{ secrets.APPLE_NOTARIZE_ID }}
APPLE_NOTARIZE_PASS: ${{ secrets.APPLE_NOTARIZE_PASS }}
APPLE_NOTARIZE_TEAM_ID: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }}
ELECTRON_BUILDER_CACHE: "/tmp/electron-builder-cache"
ELECTRON_BUILDER_DOWNLOAD_PATH: "/tmp/electron-download"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: Clear builder cache
run: |
if [ -d "$ELECTRON_BUILDER_CACHE" ]; then
rm -rf $ELECTRON_BUILDER_CACHE
fi
if [ -d "$ELECTRON_BUILDER_DOWNLOAD_PATH" ]; then
rm -rf $ELECTRON_BUILDER_DOWNLOAD_PATH
fi
- name: Install dependencies
run: npm install --package-lock-only && npm ci
- name: Install prebuilts
run: npm install @parcel/watcher-darwin-arm64@latest @parcel/watcher-darwin-x64@latest --force
- name: Decode macOS certificate
run: |
echo "$APPLE_DEVELOPER_ID_CERT" | base64 --decode > certificate.p12
- name: Import certificate to keychain
run: |
security create-keychain -p actions build.keychain
security import certificate.p12 -k ~/Library/Keychains/build.keychain -P "$APPLE_DEVELOPER_ID_CERT_PASS" -T /usr/bin/codesign
security list-keychains -d user -s ~/Library/Keychains/build.keychain
security set-keychain-settings -t 3600 -u ~/Library/Keychains/build.keychain
security unlock-keychain -p actions ~/Library/Keychains/build.keychain
security set-key-partition-list -S apple-tool:,apple: -s -k actions ~/Library/Keychains/build.keychain
- name: Build
run: npm run build:mac
- name: Generate SHA256 hashes
run: |
for file in prod/*; do
if [ -f "$file" ]; then
shasum -a 256 "$file" | awk '{print $1}' > "$file.sha256.txt"
fi
done
- name: Generate update hashes
run: npm run build:hashes
- name: Attach artifacts to release
uses: softprops/action-gh-release@v2
with:
files: |
prod/Filen_mac_x64.dmg
prod/Filen_mac_x64.dmg.sha256.txt
prod/Filen_mac_arm64.dmg
prod/Filen_mac_arm64.dmg.sha256.txt
prod/Filen_mac_x64.dmg.blockmap
prod/Filen_mac_x64.dmg.blockmap.sha256.txt
prod/Filen_mac_arm64.dmg.blockmap
prod/Filen_mac_arm64.dmg.blockmap.sha256.txt
prod/Filen_mac_x64.zip
prod/Filen_mac_x64.zip.sha256.txt
prod/Filen_mac_arm64.zip
prod/Filen_mac_arm64.zip.sha256.txt
prod/latest-mac.yml
prod/latest-mac.yml.sha256.txt
- name: Cleanup keychain
run: |
security delete-keychain build.keychain
rm -f certificate.p12
- name: Cleanup
run: npm run clear