-
-
Notifications
You must be signed in to change notification settings - Fork 804
747 lines (662 loc) · 26.9 KB
/
release.yml
File metadata and controls
747 lines (662 loc) · 26.9 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
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
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
name: 🚀 Release
run-name: Release v${{ github.ref_name }}
on:
push:
tags:
- "16.*"
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
compute-release-context:
name: 🧮 Compute release context
runs-on: ubuntu-22.04
permissions:
contents: read
outputs:
git_tag: ${{ steps.ctx.outputs.git_tag }}
major: ${{ steps.ctx.outputs.major }}
is_stable: ${{ steps.ctx.outputs.is_stable }}
is_active_major: ${{ steps.ctx.outputs.is_active_major }}
is_highest_stable_major: ${{ steps.ctx.outputs.is_highest_stable_major }}
steps:
- name: 🧮 Compute
id: ctx
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
GIT_TAG="${GITHUB_REF#refs/tags/}"
MAJOR="${GIT_TAG%%.*}"
if [[ "$GIT_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
IS_STABLE=true
else
IS_STABLE=false
fi
# Highest stable major already published as a non-prerelease, non-draft GitHub Release.
HIGHEST=$(gh release list --repo "$GITHUB_REPOSITORY" \
--exclude-drafts --exclude-pre-releases \
--limit 100 \
--json tagName \
--jq '[.[] | .tagName | select(test("^[0-9]+\\.[0-9]+\\.[0-9]+$")) | split(".")[0] | tonumber] | max // 0')
if [[ "$MAJOR" -ge "$HIGHEST" ]]; then
IS_ACTIVE_MAJOR=true
else
IS_ACTIVE_MAJOR=false
fi
if [[ "$IS_STABLE" == "true" && "$IS_ACTIVE_MAJOR" == "true" ]]; then
IS_HIGHEST_STABLE_MAJOR=true
else
IS_HIGHEST_STABLE_MAJOR=false
fi
{
echo "git_tag=$GIT_TAG"
echo "major=$MAJOR"
echo "is_stable=$IS_STABLE"
echo "is_active_major=$IS_ACTIVE_MAJOR"
echo "is_highest_stable_major=$IS_HIGHEST_STABLE_MAJOR"
} | tee -a "$GITHUB_OUTPUT"
create-draft:
name: 📝 Create Draft Release
runs-on: ubuntu-22.04
needs: [compute-release-context]
permissions:
contents: write
env:
GIT_TAG: ${{ needs.compute-release-context.outputs.git_tag }}
IS_STABLE: ${{ needs.compute-release-context.outputs.is_stable }}
steps:
- name: 📝 Create draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view "$GIT_TAG" --repo "${{ github.repository }}" >/dev/null 2>&1; then
echo "Release for $GIT_TAG already exists; leaving it untouched."
exit 0
fi
prerelease_flag=()
if [[ "$IS_STABLE" != "true" ]]; then
prerelease_flag=(--prerelease)
fi
gh release create "$GIT_TAG" \
--repo "${{ github.repository }}" \
--draft \
"${prerelease_flag[@]}" \
--title "$GIT_TAG" \
--generate-notes \
--target "$GITHUB_SHA"
release:
name: 📦 Build & Publish NuGet Packages
runs-on: ubuntu-22.04
needs: [compute-release-context, create-draft]
permissions:
contents: write
id-token: write
env:
GIT_TAG: ${{ needs.compute-release-context.outputs.git_tag }}
steps:
- name: 📦 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
show-progress: false
- name: 🛠 Install .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5
with:
dotnet-version: |
8.x
9.x
10.x
- name: 🖍️ Stamp template PackageReference versions
shell: bash
run: |
sed -i "s|0\.0\.0-placeholder|${GIT_TAG}|g" \
templates/azure-function/HotChocolate.Template.AzureFunctions.csproj \
templates/gateway/HotChocolate.Template.Gateway.csproj \
templates/server/HotChocolate.Template.Server.csproj
- name: 📦 Build NuGet Packages
shell: bash
run: |
dotnet pack src/Build.Pack.slnx \
-c Release \
-o output/packages \
-p:Version=${GIT_TAG} \
-p:NitroApiClientId="${NitroApiClientId}" \
-p:NitroIdentityClientId="${NitroIdentityClientId}" \
-p:NitroIdentityScopes="${NitroIdentityScopes}"
dotnet pack templates/HotChocolate.Templates.csproj \
-c Release \
-o output/packages \
-p:Version=${GIT_TAG}
env:
NitroApiClientId: ${{ secrets.NITRO_API_CLIENT_ID }}
NitroIdentityClientId: ${{ secrets.NITRO_IDENTITY_CLIENT_ID }}
NitroIdentityScopes: ${{ secrets.NITRO_IDENTITY_SCOPES }}
- name: 📤 Upload Nitro CLI client operations
uses: ChilliCream/nitro-client-upload@1a35b3fbdc6dac5d2aa3c49b2fb061ce15b6999c # v16.0.1-p.5
with:
tag: ${{ env.GIT_TAG }}
operations-file: src/Nitro/Common/src/ChilliCream.Nitro.Client/persisted/operations.json
client-id: ${{ secrets.NITRO_API_CLIENT_ID }}
api-key: ${{ secrets.NITRO_API_KEY }}
- name: 🚀 Publish Nitro CLI client (Dev)
uses: ChilliCream/nitro-client-publish@6b0b716ab02a9b1009facb78e4aeb2ae0c0629a1 # v16.0.1-p.5
with:
tag: ${{ env.GIT_TAG }}
stage: Dev
client-id: ${{ secrets.NITRO_API_CLIENT_ID }}
api-key: ${{ secrets.NITRO_API_KEY }}
force: true
- name: 🚀 Publish Nitro CLI client (Prod)
uses: ChilliCream/nitro-client-publish@6b0b716ab02a9b1009facb78e4aeb2ae0c0629a1 # v16.0.1-p.5
with:
tag: ${{ env.GIT_TAG }}
stage: Prod
client-id: ${{ secrets.NITRO_API_CLIENT_ID }}
api-key: ${{ secrets.NITRO_API_KEY }}
force: true
- name: NuGet login
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1
id: login
with:
user: ${{ secrets.NUGET_USERNAME }}
- name: 🚀 Push Packages to NuGet
shell: bash
run: |
for nupkg in output/packages/*.nupkg; do
dotnet nuget push "$nupkg" \
--source https://api.nuget.org/v3/index.json \
--api-key "${NUGET_API_KEY}" \
--skip-duplicate
done
env:
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
- name: 📤 Attach .nupkg assets to GitHub release
shell: bash
run: |
gh release upload "$GIT_TAG" ./output/packages/*.nupkg --repo "${{ github.repository }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-nitro-cli:
name: 🧱 Build and Publish Nitro CLI
runs-on: ${{ matrix.os }}
# We need to depend on `release`, as it publishes the persisted operations of the CLI.
needs: [compute-release-context, release]
permissions:
contents: write
env:
GIT_TAG: ${{ needs.compute-release-context.outputs.git_tag }}
strategy:
matrix:
include:
# Linux
- os: ubuntu-22.04
rid: linux-x64
- os: ubuntu-22.04
rid: linux-musl-x64
- os: ubuntu-24.04-arm
rid: linux-arm64
# macOS
- os: macos-15
rid: osx-x64
- os: macos-15
rid: osx-arm64
# Windows
- os: windows-2025
rid: win-x64
- os: windows-2025
rid: win-x86
# Commented, since azure/artifact-signing-action does not currently support ARM.
# - os: windows-11-arm
# rid: win-arm64
steps:
- name: 📦 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🛠 Install .NET
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5
with:
dotnet-version: 10.x
- name: 📦 Publish binary
shell: bash
run: |
dotnet publish src/Nitro/CommandLine/src/CommandLine \
-c Release \
-r ${{ matrix.rid }} \
-f net10.0 \
-o publish \
--self-contained \
-p:PublishAot=true \
-p:TargetFrameworks=net10.0 \
-p:RuntimeIdentifiers=${{ matrix.rid }} \
-p:Version=${GIT_TAG} \
-p:NitroApiClientId="${NitroApiClientId}" \
-p:NitroIdentityClientId="${NitroIdentityClientId}" \
-p:NitroIdentityScopes="${NitroIdentityScopes}"
env:
NitroApiClientId: ${{ secrets.NITRO_API_CLIENT_ID }}
NitroIdentityClientId: ${{ secrets.NITRO_IDENTITY_CLIENT_ID }}
NitroIdentityScopes: ${{ secrets.NITRO_IDENTITY_SCOPES }}
- name: 🖋️ Azure login (Windows)
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
if: runner.os == 'Windows'
with:
creds: ${{ secrets.SIGNING_CREDENTIALS }}
- name: 🖋️ Sign binary (Windows)
uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1
if: runner.os == 'Windows'
with:
endpoint: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_ENDPOINT }}
signing-account-name: ${{ secrets.AZURE_CODE_SIGNING_NAME }}
certificate-profile-name: ${{ secrets.WINDOWS_APP_CERT_PROFILE_NAME }}
files: ${{ github.workspace }}\publish\nitro.exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
exclude-environment-credential: true
exclude-workload-identity-credential: true
exclude-managed-identity-credential: true
exclude-shared-token-cache-credential: true
exclude-visual-studio-credential: true
exclude-visual-studio-code-credential: true
exclude-azure-cli-credential: false
exclude-azure-powershell-credential: true
exclude-azure-developer-cli-credential: true
exclude-interactive-browser-credential: true
# https://docs.github.com/en/actions/how-tos/deploy/deploy-to-third-party-platforms/sign-xcode-applications
- name: 🖋️ Setup signing resources (macOS)
if: runner.os == 'macOS'
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.APPLE_DEVELOPER_CERTFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.APPLE_DEVELOPER_CERTFICATE_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.TEMPORARY_KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
# create temporary keychain
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
- name: 🖋️ Sign binary (macOS)
if: runner.os == 'macOS'
env:
CODESIGN_IDENTITY: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_IDENTITY }}
run: |
echo "Code signing 'publish/nitro'..."
codesign --sign "$CODESIGN_IDENTITY" \
--verbose=3 \
--identifier "com.chillicream.nitro" \
--options runtime \
--timestamp \
--force \
publish/nitro
codesign --verify --deep --strict --verbose=2 publish/nitro
- name: 📦 Zip binary (Windows)
if: runner.os == 'Windows'
run: |
Compress-Archive -Path (Get-Item publish/nitro.exe) -DestinationPath nitro-${{ matrix.rid }}.zip
shell: pwsh
- name: 📦 Zip binary (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
zip -j nitro-${{ matrix.rid }}.zip publish/nitro
- name: 📦 Tar binary (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
tar -czf nitro-${{ matrix.rid }}.tar.gz -C publish nitro
- name: 🖋️ Notarize binary (macOS)
if: runner.os == 'macOS'
env:
APPLE_DEVELOPER_ID_EMAIL: ${{ secrets.APPLE_DEVELOPER_ID_EMAIL }}
APPLE_DEVELOPER_TEAM_ID: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }}
APPLE_DEVELOPER_NITRO_CLI_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_NITRO_CLI_APP_SPECIFIC_PASSWORD }}
run: |
echo "Notarizing 'nitro-${{ matrix.rid }}.zip'..."
xcrun notarytool submit nitro-${{ matrix.rid }}.zip \
--apple-id "$APPLE_DEVELOPER_ID_EMAIL" \
--team-id "$APPLE_DEVELOPER_TEAM_ID" \
--password "$APPLE_DEVELOPER_NITRO_CLI_APP_SPECIFIC_PASSWORD" \
--wait
- name: 🖋️ Clean up signing resources (macOS)
if: always() && runner.os == 'macOS'
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
- name: 📤 Upload packaged binary as artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: nitro-${{ matrix.rid }}
path: nitro-${{ matrix.rid }}.${{ runner.os == 'Linux' && 'tar.gz' || 'zip' }}
- name: 📤 Attach packaged binary to GitHub release
shell: bash
run: |
gh release upload ${{ github.ref_name }} nitro-${{ matrix.rid }}.${{ runner.os == 'Linux' && 'tar.gz' || 'zip' }} --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-nitro-cli-platforms:
name: 🧱 Publish Nitro CLI binary to npm
runs-on: ubuntu-latest
needs: [compute-release-context, build-nitro-cli]
permissions:
contents: write
id-token: write
env:
GIT_TAG: ${{ needs.compute-release-context.outputs.git_tag }}
MAJOR: ${{ needs.compute-release-context.outputs.major }}
IS_STABLE: ${{ needs.compute-release-context.outputs.is_stable }}
IS_HIGHEST_STABLE_MAJOR: ${{ needs.compute-release-context.outputs.is_highest_stable_major }}
strategy:
matrix:
rid:
- linux-x64
- linux-musl-x64
- linux-arm64
- osx-x64
- osx-arm64
- win-x64
- win-x86
steps:
- name: 📦 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🧰 Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24
registry-url: ${{ vars.NPM_REGISTRY_URL }}
scope: "@chillicream"
- name: 📥 Download nitro binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: nitro-${{ matrix.rid }}
path: dist
- name: 🗂️ Stage binary in package directory
shell: bash
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
run: |
set -euo pipefail
archive="$GITHUB_WORKSPACE/dist/nitro-${{ matrix.rid }}.tar.gz"
if [ ! -f "$archive" ]; then
archive="$GITHUB_WORKSPACE/dist/nitro-${{ matrix.rid }}.zip"
fi
case "$archive" in
*.tar.gz) tar -xzf "$archive" ;;
*.zip) unzip -q "$archive" ;;
esac
if [[ "${{ matrix.rid }}" != win-* ]]; then
chmod +x nitro
fi
- name: 🏷️ Set version
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
run: npm version "$GIT_TAG" --no-git-tag-version --allow-same-version
- name: 📦 Create tarball
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
run: npm pack
- name: 🚀 Publish tarball to npm
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
shell: bash
env:
REGISTRY: ${{ vars.NPM_REGISTRY_URL }}
TARBALL: "./chillicream-nitro-${{ matrix.rid }}-${{ needs.compute-release-context.outputs.git_tag }}.tgz"
run: |
set -euo pipefail
# Pick the band this release publishes under, based on release context.
if [[ "$IS_HIGHEST_STABLE_MAJOR" == "true" ]]; then
PRIMARY_BAND="latest"
elif [[ "$IS_STABLE" == "true" ]]; then
PRIMARY_BAND="latest-${MAJOR}"
elif [[ "$GIT_TAG" =~ -rc\. ]]; then
PRIMARY_BAND="rc"
else
PRIMARY_BAND="preview"
fi
npm publish "$TARBALL" \
--access public \
--registry="$REGISTRY" \
--tag "$PRIMARY_BAND"
- name: 📤 Upload tarball as artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: chillicream-nitro-${{ matrix.rid }}-${{ env.GIT_TAG }}.tgz
path: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}/chillicream-nitro-${{ matrix.rid }}-${{ env.GIT_TAG }}.tgz
- name: 📤 Attach tarball to GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
run: |
gh release upload "${{ github.ref_name }}" "chillicream-nitro-${{ matrix.rid }}-${{ github.ref_name }}.tgz" --repo "${{ github.repository }}"
publish-nitro-cli-npm:
name: 🧱 Publish Nitro CLI to npm
runs-on: ubuntu-latest
needs: [compute-release-context, publish-nitro-cli-platforms]
permissions:
contents: write
id-token: write
env:
GIT_TAG: ${{ needs.compute-release-context.outputs.git_tag }}
MAJOR: ${{ needs.compute-release-context.outputs.major }}
IS_STABLE: ${{ needs.compute-release-context.outputs.is_stable }}
IS_HIGHEST_STABLE_MAJOR: ${{ needs.compute-release-context.outputs.is_highest_stable_major }}
steps:
- name: 📦 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: 🧰 Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: 24
registry-url: ${{ vars.NPM_REGISTRY_URL }}
scope: "@chillicream"
- name: 🧰 Enable corepack
run: corepack enable
- name: 📥 Install dependencies
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
run: yarn install --immutable
- name: 🏗️ Build
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
run: yarn build
- name: 🏷️ Bump version and inject optionalDependencies
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
shell: bash
run: |
set -euo pipefail
npm version "$GIT_TAG" --no-git-tag-version --allow-same-version
jq --arg v "$GIT_TAG" '
.optionalDependencies = {
"@chillicream/nitro-linux-arm64": $v,
"@chillicream/nitro-linux-musl-x64": $v,
"@chillicream/nitro-linux-x64": $v,
"@chillicream/nitro-osx-arm64": $v,
"@chillicream/nitro-osx-x64": $v,
"@chillicream/nitro-win-x64": $v,
"@chillicream/nitro-win-x86": $v
}
' package.json > package.json.tmp
mv package.json.tmp package.json
- name: 📦 Create tarball
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
run: npm pack
- name: 🚀 Publish tarball to npm
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
shell: bash
env:
REGISTRY: ${{ vars.NPM_REGISTRY_URL }}
TARBALL: "./chillicream-nitro-${{ needs.compute-release-context.outputs.git_tag }}.tgz"
run: |
set -euo pipefail
# Pick the band this release publishes under, based on release context.
if [[ "$IS_HIGHEST_STABLE_MAJOR" == "true" ]]; then
PRIMARY_BAND="latest"
elif [[ "$IS_STABLE" == "true" ]]; then
PRIMARY_BAND="latest-${MAJOR}"
elif [[ "$GIT_TAG" =~ -rc\. ]]; then
PRIMARY_BAND="rc"
else
PRIMARY_BAND="preview"
fi
npm publish "$TARBALL" \
--access public \
--registry="$REGISTRY" \
--tag "$PRIMARY_BAND"
- name: 📤 Upload tarball as artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: chillicream-nitro-${{ env.GIT_TAG }}.tgz
path: src/Nitro/CommandLine/src/npm/chillicream-nitro/chillicream-nitro-${{ env.GIT_TAG }}.tgz
- name: 📤 Attach tarball to GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
run: |
gh release upload "${{ github.ref_name }}" "chillicream-nitro-${{ github.ref_name }}.tgz" --repo "${{ github.repository }}"
publish-release:
name: 🚀 Publish Release
runs-on: ubuntu-22.04
needs:
- compute-release-context
- release
- build-nitro-cli
- publish-nitro-cli-platforms
- publish-nitro-cli-npm
permissions:
contents: write
env:
GIT_TAG: ${{ needs.compute-release-context.outputs.git_tag }}
IS_STABLE: ${{ needs.compute-release-context.outputs.is_stable }}
steps:
- name: 🚀 Publish draft release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
if [[ "$IS_STABLE" == "true" ]]; then
prerelease=false
else
prerelease=true
fi
gh release edit "$GIT_TAG" \
--repo "${{ github.repository }}" \
--draft=false \
--prerelease=$prerelease
update-homebrew:
name: 🍺 Update Homebrew Tap
runs-on: ubuntu-latest
needs: [compute-release-context, publish-release]
if: needs.compute-release-context.outputs.is_stable == 'true' || needs.compute-release-context.outputs.is_active_major == 'true'
steps:
- name: 📦 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
sparse-checkout: .github/actions
show-progress: false
- name: 🔐 Create GitHub App token
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3
with:
app-id: ${{ secrets.ACTIONS_APP_ID }}
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
owner: ChilliCream
repositories: homebrew-tools
- name: 🍺 Run homebrew tap update workflow
uses: ./.github/actions/dispatch-and-watch-workflow
with:
repo: ChilliCream/homebrew-tools
workflow: release.yaml
version: ${{ needs.compute-release-context.outputs.git_tag }}
is_stable: ${{ needs.compute-release-context.outputs.is_stable }}
is_active_major: ${{ needs.compute-release-context.outputs.is_active_major }}
token: ${{ steps.app-token.outputs.token }}
update-github-actions:
name: 🔄 Update GitHub Actions
runs-on: ubuntu-latest
needs: [compute-release-context, publish-release]
strategy:
matrix:
repo:
- nitro-client-publish
- nitro-client-upload
- nitro-client-validate
- nitro-fusion-publish
- nitro-fusion-upload
- nitro-fusion-validate
- nitro-mcp-publish
- nitro-mcp-upload
- nitro-mcp-validate
- nitro-openapi-publish
- nitro-openapi-upload
- nitro-openapi-validate
- nitro-schema-publish
- nitro-schema-upload
- nitro-schema-validate
steps:
- name: 📦 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
sparse-checkout: .github/actions
show-progress: false
- name: 🔐 Create GitHub App token
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3
with:
app-id: ${{ secrets.ACTIONS_APP_ID }}
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
owner: ChilliCream
repositories: ${{ matrix.repo }}
- name: 🔄 Run action repository update workflow
uses: ./.github/actions/dispatch-and-watch-workflow
with:
repo: ChilliCream/${{ matrix.repo }}
workflow: release.yaml
version: ${{ needs.compute-release-context.outputs.git_tag }}
is_stable: ${{ needs.compute-release-context.outputs.is_stable }}
is_active_major: ${{ needs.compute-release-context.outputs.is_active_major }}
token: ${{ steps.app-token.outputs.token }}
update-azure-pipelines-extension:
name: 🔄 Update Azure Pipelines Extension
runs-on: ubuntu-latest
needs: [compute-release-context, publish-release]
if: needs.compute-release-context.outputs.is_stable == 'true'
steps:
- name: 🔐 Create GitHub App token
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3
with:
app-id: ${{ secrets.ACTIONS_APP_ID }}
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
owner: ChilliCream
repositories: nitro-azure-pipelines-tasks
- name: 🚀 Dispatch extension release workflow
id: dispatch
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPO: ChilliCream/nitro-azure-pipelines-tasks
VERSION: ${{ needs.compute-release-context.outputs.git_tag }}
IS_ACTIVE_MAJOR: ${{ needs.compute-release-context.outputs.is_active_major }}
shell: bash
run: |
set -euo pipefail
RUN_URL=$(gh workflow run release.yaml --repo "$REPO" --ref main \
-f version="$VERSION" \
-f is_active_major="$IS_ACTIVE_MAJOR")
if [ -z "$RUN_URL" ]; then
echo "::error::Dispatch did not return a run URL. Requires gh >= 2.87.0."
exit 1
fi
RUN_ID="${RUN_URL##*/}"
echo "run-id=$RUN_ID" >> "$GITHUB_OUTPUT"
echo "Dispatched run: $RUN_URL"
- name: 👀 Watch extension release run
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
REPO: ChilliCream/nitro-azure-pipelines-tasks
RUN_ID: ${{ steps.dispatch.outputs.run-id }}
shell: bash
run: gh run watch "$RUN_ID" --repo "$REPO" --exit-status --compact