-
Notifications
You must be signed in to change notification settings - Fork 25
281 lines (266 loc) · 9.03 KB
/
Copy pathrelease_desktop.yml
File metadata and controls
281 lines (266 loc) · 9.03 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
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
name: "Release: Desktop"
on:
workflow_call:
permissions:
contents: write
jobs:
build:
if: github.ref_name == 'master'
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup outputs
id: output
run: |
_NODE_VERSION=$(grep -o -P -m 1 '(?<=node":\s").*(?=")' package.json)
_BUILD_VERSION=$(grep '"version"' package.json | head -n1 | sed -E 's/.*"version": *"([^"]+)".*/\1/')
echo "NODE_VERSION=$_NODE_VERSION" >> "$GITHUB_OUTPUT"
echo "BUILD_VERSION=$_BUILD_VERSION" >> "$GITHUB_OUTPUT"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ steps.output.outputs.NODE_VERSION }}
- name: Setup cache
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- &npm-setup
name: Setup dependencies
shell: bash
run: |
find . -name "package-lock.json" -not -path "*/node_modules/*" -not -path "*/dist/*" -exec dirname {} \; | sort -u |
while read dir; do
echo "Installing dependencies for: $dir"
(cd $dir && npm ci $dir);
done
- name: Build
run: npm run build-prod-desktop-ci
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: |
dist
compression-level: 6
if-no-files-found: error
retention-days: 1
outputs:
NODE_VERSION: ${{ steps.output.outputs.NODE_VERSION }}
BUILD_VERSION: ${{ steps.output.outputs.BUILD_VERSION }}
bundle_macos:
if: github.ref_name == 'master'
runs-on: macos-14
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
path: dist/
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ needs.build.outputs.NODE_VERSION }}
- name: Setup cache
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- *npm-setup
- name: Setup codesigning
env:
APPLE_CERT_A_BASE64: ${{ secrets.APPLE_CERT_A_BASE64 }}
APPLE_PROV_PROF_BASE64: ${{ secrets.APPLE_PROV_PROF_BASE64 }}
APPLE_CERT_SECRET: ${{ secrets.APPLE_CERT_SECRET }}
APPLE_KEYCHAIN_SECRET: ${{ secrets.APPLE_KEYCHAIN_SECRET }}
run: |
CERT_A_PATH=$RUNNER_TEMP/app_certificate.p12
PROV_PROF_PATH=$RUNNER_TEMP/embedded.provisionprofile
KEYCHAIN_PATH=$RUNNER_TEMP/build.keychain
echo -n "$APPLE_CERT_A_BASE64" | base64 --decode -o $CERT_A_PATH
echo -n "$APPLE_PROV_PROF_BASE64" | base64 --decode -o $PROV_PROF_PATH
security -v create-keychain -p "$APPLE_KEYCHAIN_SECRET" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security -v default-keychain -s $KEYCHAIN_PATH
security -v unlock-keychain -p "$APPLE_KEYCHAIN_SECRET" $KEYCHAIN_PATH
security -v import $CERT_A_PATH -P "$APPLE_CERT_SECRET" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$APPLE_KEYCHAIN_SECRET" $KEYCHAIN_PATH
cp "$PROV_PROF_PATH" ./embedded.provisionprofile
- name: Bundle
run: npm run dist -- --mac --universal --publish never
- name: Notarize
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SECRET: ${{ secrets.APPLE_APP_SECRET }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
BUNDLE_PATH=$(find output -name "MEASUR-*.*.*.dmg")
xcrun notarytool submit --wait --apple-id "${{ secrets.APPLE_ID }}" --password "${{ secrets.APPLE_APP_SECRET }}" --team-id "${{ secrets.APPLE_TEAM_ID }}" $BUNDLE_PATH &&
xcrun stapler staple $BUNDLE_PATH
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-macos-artifact
path: |
output/*.zip
output/*.zip.blockmap
output/*.dmg
output/*.dmg.blockmap
output/latest*.yml
compression-level: 0
if-no-files-found: error
retention-days: 1
bundle_win:
if: github.ref_name == 'master'
runs-on: windows-2025
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
path: dist/
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ needs.build.outputs.NODE_VERSION }}
- name: Setup cache
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- *npm-setup
- name: Bundle
shell: bash
run: npm run dist -- --win --x64 --publish never
- name: Upload codesign artifact
uses: actions/upload-artifact@v4
with:
name: sign-win-artifact
path: |
output/*.exe
output/latest.yml
compression-level: 0
if-no-files-found: error
retention-days: 1
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-win-partial-artifact
path: |
output/*.exe.blockmap
compression-level: 0
if-no-files-found: error
retention-days: 1
bundle_linux:
if: github.ref_name == 'master'
runs-on: ubuntu-24.04
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
path: dist/
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ needs.build.outputs.NODE_VERSION }}
- name: Setup cache
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- *npm-setup
- name: Bundle
run: npm run dist -- --linux --x64 --publish never
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-linux-artifact
path: |
output/*.AppImage
output/latest-linux.yml
output/*.tar.gz
compression-level: 0
if-no-files-found: error
retention-days: 1
sign_win:
if: github.ref_name == 'master'
runs-on: [self-hosted, cs]
needs: [bundle_win]
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: sign-win-artifact
path: output/
- name: Codesign
run: |
TMP_CERT_PATH="$RUNNER_TEMP/cert.pem"
BUNDLE_PATH=$(find output -name "MEASUR-Setup-*.*.*.exe")
echo -n "${{ secrets.WIN_CERT_BASE64 }}" | base64 --decode > $TMP_CERT_PATH
jsign --storetype "${{ secrets.WIN_STORE_TYPE }}" \
--storepass "${{ secrets.WIN_STORE_SECRET }}" \
--tsaurl "http://timestamp.sectigo.com" \
--certfile $TMP_CERT_PATH \
$BUNDLE_PATH
OLD_HASH=$(grep -o -P -m 1 '(?<=sha512:\s).*' ./output/latest.yml)
NEW_HASH=$(gen_hash -f "$BUNDLE_PATH")
sed -i "s|$OLD_HASH|$NEW_HASH|g" ./output/latest.yml
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: release-win-artifact
path: |
output/*.exe
output/latest.yml
compression-level: 0
if-no-files-found: error
retention-days: 1
- name: Cleanup
run: rm -rf ./output
release:
if: github.ref_name == 'master'
runs-on: ubuntu-22.04
needs: [build, bundle_macos, bundle_linux, sign_win]
env:
VERSION: ${{ needs.build.outputs.BUILD_VERSION }}
steps:
- name: Get artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*-artifact
path: release
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/') # Uncomment if enabling tag gating
with:
name: MEASUR v${{ env.VERSION }}
tag_name: v${{ env.VERSION }}
target_commitish: master
draft: true # Comment out if enabling tag gating and publishing via action
generate_release_notes: false
files: |
release/*