-
Notifications
You must be signed in to change notification settings - Fork 136
393 lines (336 loc) · 14 KB
/
monokle-publish-updater.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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
name: monokle-sign-notarize-publish-updater
on:
push:
branches:
- auto-updater
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# This workflow contains a single job called "build"
build-and-publish-mac:
runs-on: macos-latest
steps:
- name: Delete release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: latest-version
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Checkout Project
uses: actions/checkout@v2
# Check memory and cpu
- name: Verify Runner Resources
run: |
sysctl -n machdep.cpu.brand_string
vm_stat | perl -ne '/page size of (\d+)/ and $size=$1; /Pages\s+([^:]+)[^\d]+(\d+)/ and printf("%-16s % 16.2f Mi\n", "$1:", $2 * $size / 1048576);'
- name: Install Tools
run: |
brew install jq
- name: Add MacOS certs
run: |
ls -la
chmod +x .github/workflows/scripts/add-osx-cert.sh && .github/workflows/scripts/add-osx-cert.sh
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.MONOKLE_MACOS_CERTS }}
CERTIFICATE_PASSWORD: ${{ secrets.MONOKLE_MACOS_CERTS_PASSWORD }}
- name: Electron mac os security identities
run: security find-identity -v
- name: Get Node Version
run: |
cat .nvmrc
echo "::set-output name=nodeversion::$(cat .nvmrc)"
id: get-node-version
- name: Use Node.js ${{ steps.get-node-version.outputs.nodeversion }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.get-node-version.outputs.nodeversion }}
cache: 'npm'
# Fixes issues with node-gyp https://github.com/nodejs/node-gyp/issues/2869
- name: Install Python utilities
run: python3 -m pip install setuptools --break-system-packages
- name: Install Dependencies
run: |
env
echo "npm: $(npm --version)"
echo "node: $(node --version)"
npm install
- name: Install dmg-license
run: npm install dmg-license
# - name: Verify Dependencies
# run: |
# ls -la
# npm list --depth=1
- name: Build
run: |
contents="$(jq --arg SENTRY_DSN $SENTRY_DSN '.SENTRY_DSN = $SENTRY_DSN' electron/env.json)" && echo "${contents}" > electron/env.json
contents="$(jq --arg MONOKLE_INSTALLS_URL $MONOKLE_INSTALLS_URL '.MONOKLE_INSTALLS_URL = $MONOKLE_INSTALLS_URL' electron/env.json)" && echo "${contents}" > electron/env.json
contents="$(jq --arg SEGMENT_API_KEY $SEGMENT_API_KEY '.SEGMENT_API_KEY = $SEGMENT_API_KEY' electron/env.json)" && echo "${contents}" > electron/env.json
npm run electron:build:ci
env:
# Set CI flag to false, or the build fails on all warnings, not just errors as locally.
CI: false
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
MONOKLE_INSTALLS_URL: ${{ secrets.MONOKLE_INSTALLS_URL }}
SEGMENT_API_KEY: ${{ secrets.SEGMENT_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
REACT_APP_NEWS_FEED_URL: ${{ secrets.REACT_APP_NEWS_FEED_URL }}
- name: Package
run: |
contents="$(jq '.build.artifactName = "${productName}-${os}-${arch}.${ext}"' package.json)" && echo "${contents}" > package.json
contents="$(jq '.build.appImage.artifactName = "${productName}-${os}-${arch}.${ext}"' package.json)" && echo "${contents}" > package.json
npm exec -c "electron-builder --publish \"never\""
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
EP_PRE_RELEASE: true
NOTARIZE: true
CSC_LINK: ${{ secrets.MONOKLE_MACOS_CERTS }}
CSC_KEY_PASSWORD: ${{ secrets.MONOKLE_MACOS_CERTS_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
USE_HARD_LINKS: false
# Check Binary Size
- name: Build Succeeded
run: |
ls -alh dist | grep Monokle && du -sh dist/mac || true
if: ${{ success() }}
- name: Create release and upload artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: 'dist/latest-mac.yml,dist/*.dmg,dist/*.blockmap,dist/*.zip'
draft: false
prerelease: true
omitBody: true
tag: 'latest-version'
commit: 'auto-updater'
token: ${{ secrets.github_token }}
- name: Archive Binary
uses: actions/upload-artifact@v2
with:
name: dist-mac
path: dist
if: ${{ success() }}
- name: Build Failed - Output Build Logs
run: |
cat /Users/runner/.npm/_logs/*-debug.log || true
if: ${{ failure() || cancelled() }}
- name: Build Failed - Archive Build Logs
uses: actions/upload-artifact@v2
with:
name: logs
path: /Users/runner/.npm/_logs
if: ${{ failure() || cancelled() }}
# Make sure no secrets or certs are left on the runner
- name: Cleanup files after run
run: |
rm -rf *
ls -la
if: ${{ always() }}
build-and-publish-windows:
runs-on: windows-latest
steps:
- name: Delete release and tagname
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: latest-version
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Checkout Project
uses: actions/checkout@v2
- name: Install Tools
run: |
choco install jq dotnet-5.0-runtime dotnetcore-sdk -y
dotnet tool install --version 3.0.0 --global AzureSignTool
- name: Get Node Version
run: |
Set-PSDebug -Trace 1
$filePath = "D:\a\monokle\monokle\.nvmrc"
Get-Content $filePath -Raw
$content = Get-Content $filePath -Raw
echo "::set-output name=nodeversion::$content"
id: get-node-version
- name: Use Node.js ${{ steps.get-node-version.outputs.nodeversion }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.get-node-version.outputs.nodeversion }}
cache: 'npm'
# Fixes issues with node-gyp https://github.com/nodejs/node-gyp/issues/2869
- name: Install Python utilities
run: python3 -m pip install setuptools --break-system-packages
# Install Dependencies
- name: Install Dependencies
run: |
Set-PSDebug -Trace 1
node --version
npm --version
npm install
# - name: Verify Dependencies
# run: |
# cmd /r dir
# npm list --depth=1
- name: Build
shell: PowerShell
run: |
($contents=jq --arg SENTRY_DSN $env:SENTRY_DSN '.SENTRY_DSN = $SENTRY_DSN' electron\env.json) -and ($contents | set-content electron\env.json -Encoding Ascii)
($contents=jq --arg MONOKLE_INSTALLS_URL $env:MONOKLE_INSTALLS_URL '.MONOKLE_INSTALLS_URL = $MONOKLE_INSTALLS_URL' electron\env.json) -and ($contents | set-content electron\env.json -Encoding Ascii)
($contents=jq --arg SEGMENT_API_KEY $env:SEGMENT_API_KEY '.SEGMENT_API_KEY = $SEGMENT_API_KEY' electron\env.json) -and ($contents | set-content electron\env.json -Encoding Ascii)
npm run electron:build:ci
env:
# Set CI flag to false, or the build fails on all warnings, not just errors as locally.
CI: false
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
MONOKLE_INSTALLS_URL: ${{ secrets.MONOKLE_INSTALLS_URL }}
SEGMENT_API_KEY: ${{ secrets.SEGMENT_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
REACT_APP_NEWS_FEED_URL: ${{ secrets.REACT_APP_NEWS_FEED_URL }}
- name: Package
run: |
($contents=jq --arg artifactName '${productName}-${os}-${arch}.${ext}' '.build.artifactName = $artifactName' package.json) -and ($contents | set-content package.json -Encoding Ascii)
($contents=jq --arg artifactName '${productName}-${os}-${arch}.${ext}' '.build.appImage.artifactName = $artifactName' package.json) -and ($contents | set-content package.json -Encoding Ascii)
npm exec -c 'electron-builder --publish "never"'
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
EP_PRE_RELEASE: true
USE_HARD_LINKS: false
# Check Binary Size
- name: Build Succeeded
run: |
cmd /r dir .\dist
if: ${{ success() }}
- name: Create release and upload artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: 'dist/latest.yml,dist/*.exe,dist/*.blockmap'
draft: false
prerelease: true
omitBody: true
tag: 'latest-version'
commit: 'auto-updater'
token: ${{ secrets.github_token }}
- name: Archive Binary
uses: actions/upload-artifact@v2
with:
name: dist-win
path: dist
if: ${{ success() }}
# This workflow contains a single job called "build"
build-and-publish-linux:
runs-on: ubuntu-latest
steps:
- name: Delete release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: latest-version
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
- name: Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Checkout Project
uses: actions/checkout@v2
- name: Get Node Version
run: |
cat .nvmrc
echo "::set-output name=nodeversion::$(cat .nvmrc)"
id: get-node-version
- name: Use Node.js ${{ steps.get-node-version.outputs.nodeversion }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.get-node-version.outputs.nodeversion }}
cache: 'npm'
# Fixes issues with node-gyp https://github.com/nodejs/node-gyp/issues/2869
- name: Install Python utilities
run: python3 -m pip install setuptools --break-system-packages
- name: Install Dependencies
run: |
env
echo "npm: $(npm --version)"
echo "node: $(node --version)"
npm install
# - name: Verify Dependencies
# run: |
# ls -la
# npm list --depth=1
- name: Install Tools
run: |
sudo apt-get install jq
- name: Build
run: |
contents="$(jq --arg SENTRY_DSN $SENTRY_DSN '.SENTRY_DSN = $SENTRY_DSN' electron/env.json)" && echo "${contents}" > electron/env.json
contents="$(jq --arg MONOKLE_INSTALLS_URL $MONOKLE_INSTALLS_URL '.MONOKLE_INSTALLS_URL = $MONOKLE_INSTALLS_URL' electron/env.json)" && echo "${contents}" > electron/env.json
contents="$(jq --arg SEGMENT_API_KEY $SEGMENT_API_KEY '.SEGMENT_API_KEY = $SEGMENT_API_KEY' electron/env.json)" && echo "${contents}" > electron/env.json
npm run electron:build:ci
env:
# Set CI flag to false, or the build fails on all warnings, not just errors as locally.
CI: false
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
MONOKLE_INSTALLS_URL: ${{ secrets.MONOKLE_INSTALLS_URL }}
SEGMENT_API_KEY: ${{ secrets.SEGMENT_API_KEY }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
REACT_APP_NEWS_FEED_URL: ${{ secrets.REACT_APP_NEWS_FEED_URL }}
- name: Package
run: |
contents="$(jq '.build.artifactName = "${productName}-${os}-${arch}.${ext}"' package.json)" && echo "${contents}" > package.json
contents="$(jq '.build.appImage.artifactName = "${productName}-${os}-${arch}.${ext}"' package.json)" && echo "${contents}" > package.json
npm exec -c "electron-builder --publish \"never\""
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
EP_PRE_RELEASE: true
USE_HARD_LINKS: false
# Check Binary Size
- name: Build Succeeded
run: |
ls -alh dist | grep Monokle && du -sh dist || true
if: ${{ success() }}
- name: Create release and upload artifacts
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: 'dist/latest-linux.yml,dist/latest-linux-arm64.yml,dist/*.deb,dist/*.AppImage,dist/*.rpm'
draft: false
prerelease: true
omitBody: true
tag: 'latest-version'
commit: 'auto-updater'
token: ${{ secrets.github_token }}
- name: Archive Binary
uses: actions/upload-artifact@v2
with:
name: dist-nix
path: dist
if: ${{ success() }}
- name: Build Failed - Output Build Logs
run: |
cat /Users/runner/.npm/_logs/*-debug.log || true
if: ${{ failure() || cancelled() }}
- name: Build Failed - Archive Build Logs
uses: actions/upload-artifact@v2
with:
name: logs
path: /Users/runner/.npm/_logs
if: ${{ failure() || cancelled() }}
# Make sure no secrets or certs are left on the runner
- name: Cleanup files after run
run: |
rm -rf *
ls -la
if: ${{ always() }}