forked from quarto-dev/quarto-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
608 lines (524 loc) · 21.3 KB
/
create-release.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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
name: Build Installers
on:
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
inputs:
publish-release:
description: "Publish Release"
required: false
type: boolean
default: true
pre-release:
description: "Pre-release"
required: false
type: boolean
default: true
concurrency:
# make publishing release concurrent (but others trigger not)
group: building-releases-${{ inputs.publish-release && 'prerelease' || github.run_id }}
jobs:
configure:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.read-version.outputs.version_full }}
version_base: ${{ steps.read-version.outputs.version }}
tag_name: v${{ steps.read-version.outputs.version_full }}
version_commit: ${{ steps.version_commit.outputs.commit_long_sha }}
pushed: ${{ steps.version_commit.outputs.pushed }}
tag_pushed: ${{ steps.version_commit.outputs.tag_pushed }}
if: github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository == 'quarto-dev/quarto-cli')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get previous version
id: read-version
run: |
source ./configuration
read_version=$(cat version.txt)
version=$(echo $read_version | grep -o '[[:digit:]]*\.[[:digit:]]*' | head -1)
if [ "$version" == "$QUARTO_VERSION" ]; then
## This should be the case only when we do a new patch release or for next pre-release to build.
build_number=$(($(echo $read_version | grep -o '[[:digit:]]*' | tail -1)+1))
else
## This should be the case only when we do a new major/minor release, for next pre-release to build.
version=$QUARTO_VERSION
build_number=0
news="news/changelog-${version}.md"
if [ ! -f "$news" ]; then
echo -e "All changes included in ${version}:\n\n" > $news
fi
fi
version_full=$version.$build_number
echo "version=$version" >> $GITHUB_OUTPUT
echo "version_full=$version_full">> $GITHUB_OUTPUT
echo "**Changelog since last release**: https://github.com/${GITHUB_REPOSITORY}/compare/v${read_version}...v${version_full}" > "release_note.md"
echo -e "\n\nFull ${version} changelog up to this version:\n" >> "release_note.md"
echo -e " * View: https://github.com/${GITHUB_REPOSITORY}/blob/v${version_full}/news/changelog-${version}.md\n" >> "release_note.md"
echo -e " * Download: https://github.com/${GITHUB_REPOSITORY}/releases/download/v${version_full}/changelog.md\n" >> "release_note.md"
# TODO: uncomment this again if new issue with RHEL build
# echo -e "" >> "release_note.md"
# echo -e "Due to an issue with upstream dependency, the RHEL build may not included in this release." >> "release_note.md"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: News
path: |
./news/changelog-${{steps.read-version.outputs.version}}.md
./release_note.md
- name: Update version.txt
run: |
echo ${{ steps.read-version.outputs.version_full }} > version.txt
- uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5
if: ${{ inputs.publish-release }}
id: version_commit
with:
add: '["version.txt", "news/changelog-${{steps.read-version.outputs.version}}.md"]'
tag: v${{ steps.read-version.outputs.version_full }}
message: "Update version.txt"
fetch: true
default_author: github_actions
make-source-tarball:
runs-on: ubuntu-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Make Tarball
run: |
tar --owner=root --group=root -zcvf quarto-${{needs.configure.outputs.version}}.tar.gz *
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Source
path: ./quarto-${{needs.configure.outputs.version}}.tar.gz
make-tarball:
runs-on: ubuntu-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
./configure.sh
- name: Prepare Distribution
run: |
pushd package/src/
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --log-level info
popd
- name: Make Tarball
run: |
pushd package/
mv pkg-working quarto-${{needs.configure.outputs.version}}
tar --owner=root --group=root -cvf quarto-${{needs.configure.outputs.version}}-linux-amd64.tar quarto-${{needs.configure.outputs.version}}
gzip quarto-${{needs.configure.outputs.version}}-linux-amd64.tar
mv quarto-${{needs.configure.outputs.version}} pkg-working
popd
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Deb Zip
path: ./package/quarto-${{needs.configure.outputs.version}}-linux-amd64.tar.gz
make-arm64-tarball:
runs-on: ubuntu-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
./configure.sh
- name: Prepare Distribution
run: |
pushd package/src/
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --arch aarch64 --log-level info
popd
- name: Make Tarball
run: |
pushd package/
mv pkg-working quarto-${{needs.configure.outputs.version}}
tar --owner=root --group=root -cvf quarto-${{needs.configure.outputs.version}}-linux-arm64.tar quarto-${{needs.configure.outputs.version}}
gzip quarto-${{needs.configure.outputs.version}}-linux-arm64.tar
mv quarto-${{needs.configure.outputs.version}} pkg-working
popd
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Deb Arm64 Zip
path: ./package/quarto-${{needs.configure.outputs.version}}-linux-arm64.tar.gz
make-tarball-rhel:
runs-on: ubuntu-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
./configure.sh
- name: Prepare Distribution
run: |
pushd package/src/
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --log-level info
popd
- name: Move Custom Deno
run: |
source ./configuration
echo Placing custom Deno ${DENO:1}. See available versions at https://anaconda.org/conda-forge/deno/files
curl -L https://anaconda.org/conda-forge/deno/${DENO:1}/download/linux-64/deno-${DENO:1}-hfc7925d_0.conda --output deno.conda
unzip deno.conda
tar --use-compress-program=unzstd -xvf pkg-deno-${DENO:1}-hfc7925d_0.tar.zst
cp bin/deno package/pkg-working/bin/tools/x86_64/deno
- name: Make Tarball
run: |
pushd package/
mv pkg-working quarto-${{needs.configure.outputs.version}}
tar --owner=root --group=root -cvf quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar quarto-${{needs.configure.outputs.version}}
gzip quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar
mv quarto-${{needs.configure.outputs.version}} pkg-working
popd
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: RHEL Zip
path: ./package/quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar.gz
make-installer-arm64-deb:
runs-on: ubuntu-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
./configure.sh
- name: Prepare Distribution
run: |
pushd package/src/
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --arch aarch64 --log-level info
popd
- name: Make Installer
run: |
pushd package/src/
./quarto-bld make-installer-deb --set-version ${{needs.configure.outputs.version}} --arch aarch64 --log-level info
popd
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Deb Arm64 Installer
path: ./package/out/quarto-${{needs.configure.outputs.version}}-linux-arm64.deb
make-installer-deb:
runs-on: ubuntu-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
./configure.sh
- name: Prepare Distribution
run: |
pushd package/src/
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --log-level info
popd
- name: Make Installer
run: |
pushd package/src/
./quarto-bld make-installer-deb --set-version ${{needs.configure.outputs.version}} --log-level info
popd
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Deb Installer
path: ./package/out/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
test-tarball-linux:
runs-on: ubuntu-latest
needs: [configure, make-tarball]
steps:
- uses: actions/download-artifact@v3
with:
name: Deb Zip
path: .
- run: |
tar -zxf quarto-${{needs.configure.outputs.version}}-linux-amd64.tar.gz
echo "$GITHUB_WORKSPACE/quarto-${{needs.configure.outputs.version}}/bin" >> $GITHUB_PATH
- run: |
tar -tzvf quarto-${{needs.configure.outputs.version}}-linux-amd64.tar.gz | head
ls -lR
echo $PATH
quarto check
quarto --paths
quarto --version
make-installer-win:
runs-on: windows-latest
needs: [configure]
steps:
- name: Configure Rust Tools
run: |
rustup.exe toolchain install 1.63.0 --component rustfmt --component clippy --no-self-update
rustup.exe default 1.63.0
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
.\configure.cmd
- name: Prepare Distribution
run: |
pushd package\src\
.\quarto-bld.cmd prepare-dist --set-version ${{needs.configure.outputs.version}} --log-level info
popd
- name: Build Launcher
run: |
cargo build --release --all-features --manifest-path package/launcher/Cargo.toml
cp package/launcher/target/release/quarto.exe package/pkg-working/bin/quarto.exe
- name: Make Installer
run: |
pushd package\src\
.\quarto-bld.cmd make-installer-win --set-version ${{needs.configure.outputs.version}} --log-level debug
popd
env:
QUARTO_WIN_PFX: ${{ secrets.WIN_PFX }}
QUARTO_WIN_PFX_PW: ${{ secrets.WIN_PFX_PW }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Windows Installer
path: ./package/out/quarto-${{needs.configure.outputs.version}}-win.msi
- name: Upload Zip
uses: actions/upload-artifact@v3
with:
name: Windows Zip
path: ./package/out/quarto-${{needs.configure.outputs.version}}-win.zip
test-zip-win:
runs-on: windows-latest
needs: [configure, make-installer-win]
steps:
- uses: actions/download-artifact@v3
with:
name: Windows Zip
path: .
- run: |
tar -xf quarto-${{needs.configure.outputs.version}}-win.zip
- run: Add-Content $env:GITHUB_PATH "$env:GITHUB_WORKSPACE\bin"
- run: |
quarto check
quarto --paths
quarto --version
make-installer-mac:
runs-on: macos-latest
needs: [configure]
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.configure.outputs.version_commit }}
- name: Configure
run: |
./configure.sh
- uses: ./.github/workflows/actions/keychain
with:
certificate-value: ${{ secrets.APPLE_SIGN_P12 }}
certificate-password: ${{ secrets.APPLE_SIGN_PW }}
keychain: "build.keychain"
keychain-pw: ${{ secrets.APPLE_KEYCHAIN_PW }}
certificate-file: certificate.p12
- uses: ./.github/workflows/actions/keychain
with:
certificate-value: ${{ secrets.APPLE_INSTALLER_P12 }}
certificate-password: ${{ secrets.APPLE_INSTALLER_PW }}
keychain: "build.keychain"
keychain-pw: ${{ secrets.APPLE_KEYCHAIN_PW }}
certificate-file: installer.p12
- name: Prepare Distribution
run: |
security find-identity
security find-certificate -a
pushd package/src/
./quarto-bld prepare-dist --set-version ${{needs.configure.outputs.version}} --log-level info
popd
- name: Make Installer
run: |
pushd package/src/
./quarto-bld make-installer-mac --set-version ${{needs.configure.outputs.version}} --log-level info
popd
env:
QUARTO_APPLE_APP_DEV_ID: ${{ secrets.APPLE_SIGN_ID }}
QUARTO_APPLE_INST_DEV_ID: ${{ secrets.APPLE_INSTALLER_ID }}
QUARTO_APPLE_CONNECT_TEAMID: ${{ secrets.APPLE_CONNECT_TEAMID }}
QUARTO_APPLE_CONNECT_UN: ${{ secrets.APPLE_CONNECT_UN }}
QUARTO_APPLE_CONNECT_PW: ${{ secrets.APPLE_CONNECT_PW }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Mac Installer
path: ./package/out/quarto-${{needs.configure.outputs.version}}-macos.pkg
- name: Upload Zip
uses: actions/upload-artifact@v3
with:
name: Mac Zip
path: ./package/out/quarto-${{needs.configure.outputs.version}}-macos.tar.gz
- name: Cleanup Keychain
if: ${{ always() }}
run: |
security delete-keychain build.keychain
test-zip-mac:
runs-on: macos-latest
needs: [configure, make-installer-mac]
steps:
- uses: actions/download-artifact@v3
with:
name: Mac Zip
path: .
- run: |
tar -zxf quarto-${{needs.configure.outputs.version}}-macos.tar.gz
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- run: tar -tzvf quarto-${{needs.configure.outputs.version}}-macos.tar.gz | head
- run: ls -lR
- run: echo $PATH
- run: |
quarto check
quarto --paths
quarto --version
publish-release:
if: ${{ inputs.publish-release }}
runs-on: ubuntu-latest
needs: [
configure,
make-installer-deb,
make-installer-arm64-deb,
make-installer-win,
make-installer-mac,
# optional in release to not be blocked by RHEL build depending on conda-forge deno dependency
# make-tarball-rhel,
make-arm64-tarball,
make-tarball,
make-source-tarball,
test-zip-win,
test-zip-mac,
test-tarball-linux,
]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- name: Rename news
run: |
ls -la ./News
mv ./News/news/changelog-${{needs.configure.outputs.version_base}}.md ./News/news/changelog.md
- name: Generate Checksums
id: generate_checksum
run: |
pushd Windows\ Installer
sha256sum quarto-${{needs.configure.outputs.version}}-win.msi >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Windows\ Zip
sha256sum quarto-${{needs.configure.outputs.version}}-win.zip >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Mac\ Zip
sha256sum quarto-${{needs.configure.outputs.version}}-macos.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Mac\ Installer
sha256sum quarto-${{needs.configure.outputs.version}}-macos.pkg >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
if [ -f "RHEL Zip/quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar.gz" ]; then
pushd RHEL\ Zip
sha256sum quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
fi
pushd Deb\ Zip
sha256sum quarto-${{needs.configure.outputs.version}}-linux-amd64.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Deb\ Arm64\ Zip
sha256sum quarto-${{needs.configure.outputs.version}}-linux-arm64.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Deb\ Installer
sha256sum quarto-${{needs.configure.outputs.version}}-linux-amd64.deb >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Deb\ Arm64\ Installer
sha256sum quarto-${{needs.configure.outputs.version}}-linux-arm64.deb >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
pushd Source
sha256sum quarto-${{needs.configure.outputs.version}}.tar.gz >> ../quarto-${{needs.configure.outputs.version}}-checksums.txt
popd
- name: Create Release
id: create_release
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{needs.configure.outputs.tag_name}}
target_commitish: ${{ needs.configure.outputs.version_commit }}
name: ${{needs.configure.outputs.tag_name}}
body_path: ./News/release_note.md
draft: false
prerelease: ${{ inputs.pre-release }}
fail_on_unmatched_files: false # rhel build may not be included
files: |
./Source/quarto-${{needs.configure.outputs.version}}.tar.gz
./Deb Zip/quarto-${{needs.configure.outputs.version}}-linux-amd64.tar.gz
./Deb Arm64 Zip/quarto-${{needs.configure.outputs.version}}-linux-arm64.tar.gz
./RHEL Zip/quarto-${{needs.configure.outputs.version}}-linux-rhel7-amd64.tar.gz
./Deb Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
./Deb Arm64 Installer/quarto-${{needs.configure.outputs.version}}-linux-arm64.deb
./Windows Installer/quarto-${{needs.configure.outputs.version}}-win.msi
./Windows Zip/quarto-${{needs.configure.outputs.version}}-win.zip
./Mac Installer/quarto-${{needs.configure.outputs.version}}-macos.pkg
./Mac Zip/quarto-${{needs.configure.outputs.version}}-macos.tar.gz
./News/news/changelog.md
quarto-${{needs.configure.outputs.version}}-checksums.txt
cleanup-when-failure:
if: ${{ (failure() || cancelled()) && inputs.publish-release }}
needs: [
configure,
make-installer-deb,
make-installer-arm64-deb,
make-installer-win,
make-installer-mac,
# optional in release to not be blocked by RHEL build depending on conda-forge deno dependency
# make-tarball-rhel,
make-arm64-tarball,
make-tarball,
make-source-tarball,
test-zip-win,
test-zip-mac,
test-tarball-linux,
publish-release,
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Revert commit of version.txt
if: ${{ needs.configure.outputs.pushed }}
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git pull origin $GITHUB_REF_NAME
git stash -u
git revert -n ${{ needs.configure.outputs.version_commit }}
git add .
git commit -m 'Revert version.txt update (${{ needs.configure.outputs.version_commit }})' -m 'Publishing release has failed.'
git push origin $GITHUB_REF_NAME
- name: Deleted created tag
if: ${{ needs.configure.outputs.tag_pushed }}
run: |
git push --delete origin ${{ needs.configure.outputs.tag_name }}
docker-push:
if: ${{ inputs.publish-release }}
runs-on: ubuntu-latest
needs: [configure, publish-release]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
- uses: quarto-dev/quarto-cli/.github/actions/docker@main
with:
source: ./Deb Installer/quarto-${{needs.configure.outputs.version}}-linux-amd64.deb
version: ${{needs.configure.outputs.version}}
token: ${{ secrets.GITHUB_TOKEN }}
username: ${{ github.actor }}
org: ${{ github.repository_owner }}
name: quarto
daily: ${{ inputs.pre-release }}