@@ -99,12 +99,11 @@ jobs:
9999 strategy :
100100 matrix :
101101 include :
102- # Linux (x64)
102+ # Linux
103103 - os : ubuntu-22.04
104104 rid : linux-x64
105105 - os : ubuntu-22.04
106106 rid : linux-musl-x64
107- # Linux (arm64 on ARM runner!)
108107 - os : ubuntu-24.04-arm
109108 rid : linux-arm64
110109 # macOS
@@ -117,7 +116,7 @@ jobs:
117116 rid : win-x64
118117 - os : windows-2025
119118 rid : win-x86
120- # Windows (arm64 on ARM runner!)
119+ # Commented, since azure/artifact-signing-action does not currently support ARM.
121120 # - os: windows-11-arm
122121 # rid: win-arm64
123122
@@ -137,8 +136,8 @@ jobs:
137136
138137 - name : 🏷 Get the version from tag (Unix)
139138 if : runner.os != 'Windows'
140- run : echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
141139 shell : bash
140+ run : echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
142141
143142 - name : 📦 Publish binary (Windows)
144143 if : runner.os == 'Windows'
@@ -152,9 +151,9 @@ jobs:
152151
153152 - name : 📦 Publish binary (Unix)
154153 if : runner.os != 'Windows'
154+ shell : bash
155155 run : |
156156 ./build.sh publishaot --SemVersion $GIT_TAG --RuntimeIdentifier ${{ matrix.rid }} --Configuration Release
157- shell : bash
158157 env :
159158 NitroApiClientId : ${{ secrets.NITRO_API_CLIENT_ID }}
160159 NitroIdentityClientId : ${{ secrets.NITRO_IDENTITY_CLIENT_ID }}
@@ -238,15 +237,15 @@ jobs:
238237
239238 - name : 📦 Zip binary (macOS)
240239 if : runner.os == 'macOS'
240+ shell : bash
241241 run : |
242242 zip -j nitro-${{ matrix.rid }}.zip publish/nitro
243- shell : bash
244243
245244 - name : 📦 Tar binary (Linux)
246245 if : runner.os == 'Linux'
246+ shell : bash
247247 run : |
248248 tar -czf nitro-${{ matrix.rid }}.tar.gz -C publish nitro
249- shell : bash
250249
251250 - name : 🖋️ Notarize binary (macOS)
252251 if : runner.os == 'macOS'
@@ -296,14 +295,31 @@ jobs:
296295 env :
297296 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
298297
299- publish-nitro-cli-npm :
300- name : 🧱 Publish Nitro CLI to npm
298+ publish-nitro-cli-platforms :
299+ name : 🧱 Publish Nitro CLI (${{ matrix.rid }}) to npm
301300 runs-on : ubuntu-latest
302301 needs : [build-nitro-cli]
303302 if : startsWith(github.ref, 'refs/tags/')
304303 permissions :
305304 contents : write
306305 id-token : write
306+ strategy :
307+ matrix :
308+ include :
309+ - rid : linux-x64
310+ binary : nitro
311+ - rid : linux-musl-x64
312+ binary : nitro
313+ - rid : linux-arm64
314+ binary : nitro
315+ - rid : osx-x64
316+ binary : nitro
317+ - rid : osx-arm64
318+ binary : nitro
319+ - rid : win-x64
320+ binary : nitro.exe
321+ - rid : win-x86
322+ binary : nitro.exe
307323
308324 steps :
309325 - name : 📦 Checkout
@@ -316,96 +332,148 @@ jobs:
316332 registry-url : ${{ vars.NPM_REGISTRY_URL }}
317333 scope : " @chillicream"
318334
319- - name : 🧰 Enable corepack
320- run : corepack enable
321-
322- - name : 📥 Download all packaged nitro binaries
335+ - name : 📥 Download nitro binary
323336 uses : actions/download-artifact@v8
324337 with :
325- pattern : nitro-*
326- merge-multiple : true
327- path : dist-archives
338+ name : nitro-${{ matrix.rid }}
339+ path : dist
328340
329341 - name : 🏷 Get the version from tag
330342 run : echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
331343
332- - name : 🗂️ Move binaries to npm package
344+ - name : 🗂️ Stage binary in package directory
345+ shell : bash
346+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
333347 run : |
334- PACKAGE_DIR="src/Nitro/CommandLine/src/chillicream-nitro"
335-
336- for archive in dist-archives/nitro-*; do
337- base=$(basename "$archive")
338-
339- case "$base" in
340- nitro-*.zip)
341- rid=${base#nitro-}
342- rid=${rid%.zip}
343- echo "Unpacking $archive -> $PACKAGE_DIR/$rid"
344- mkdir -p "$PACKAGE_DIR/$rid"
345- unzip -q "$archive" -d "$PACKAGE_DIR/$rid"
346- ;;
347- nitro-*.tar.gz)
348- rid=${base#nitro-}
349- rid=${rid%.tar.gz}
350- echo "Unpacking $archive -> $PACKAGE_DIR/$rid"
351- mkdir -p "$PACKAGE_DIR/$rid"
352- tar -xzf "$archive" -C "$PACKAGE_DIR/$rid"
353- ;;
354- *)
355- echo "Skipping unknown artifact: $archive"
356- ;;
357- esac
358- done
359-
360- # Ensure unix binaries are executable
361- chmod +x $PACKAGE_DIR/linux-x64/nitro || true
362- chmod +x $PACKAGE_DIR/linux-musl-x64/nitro || true
363- chmod +x $PACKAGE_DIR/linux-arm64/nitro || true
364- chmod +x $PACKAGE_DIR/osx-x64/nitro || true
365- chmod +x $PACKAGE_DIR/osx-arm64/nitro || true
366-
367- # Ensure cli.js is executable
368- chmod +x $PACKAGE_DIR/cli.js
369-
370- - name : 🔍 Install dependencies
371- working-directory : src/Nitro/CommandLine/src/chillicream-nitro
372- run : yarn install --immutable
373-
374- - name : 📥 Install npm@11.9.0
375- run : npm install -g npm@11.9.0
348+ set -euo pipefail
349+ archive="$GITHUB_WORKSPACE/dist/nitro-${{ matrix.rid }}.tar.gz"
350+ if [ ! -f "$archive" ]; then
351+ archive="$GITHUB_WORKSPACE/dist/nitro-${{ matrix.rid }}.zip"
352+ fi
353+ case "$archive" in
354+ *.tar.gz) tar -xzf "$archive" ;;
355+ *.zip) unzip -q "$archive" ;;
356+ esac
357+ if [ "${{ matrix.binary }}" = "nitro" ]; then
358+ chmod +x "${{ matrix.binary }}"
359+ fi
376360
377361 - name : 🏷️ Set version
378- working-directory : src/Nitro/CommandLine/src/chillicream-nitro
379- run : npm version $GIT_TAG
362+ working-directory : src/Nitro/CommandLine/src/npm/ chillicream-nitro-${{ matrix.rid }}
363+ run : npm version " $GIT_TAG" --no-git-tag-version --allow-same-version
380364
381365 - name : 📦 Create tarball
382- working-directory : src/Nitro/CommandLine/src/chillicream-nitro
366+ working-directory : src/Nitro/CommandLine/src/npm/ chillicream-nitro-${{ matrix.rid }}
383367 run : npm pack
384368
385369 - name : 🚀 Publish tarball to npm
386- working-directory : src/Nitro/CommandLine/src/chillicream-nitro
370+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
371+ shell : bash
372+ run : |
373+ npm publish "./chillicream-nitro-${{ matrix.rid }}-${GIT_TAG}.tgz" \
374+ --access public \
375+ --registry="${{ vars.NPM_REGISTRY_URL }}"
376+
377+ - name : 📤 Upload tarball as artifact
378+ uses : actions/upload-artifact@v7
379+ with :
380+ name : chillicream-nitro-${{ matrix.rid }}-${{ env.GIT_TAG }}.tgz
381+ path : src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}/chillicream-nitro-${{ matrix.rid }}-${{ env.GIT_TAG }}.tgz
382+
383+ - name : 📤 Attach tarball to GitHub release
384+ env :
385+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
386+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
387387 run : |
388- TARBALL="chillicream-nitro-${GIT_TAG}.tgz"
388+ gh release upload "${{ github.ref_name }}" "chillicream-nitro-${{ matrix.rid }}-${{ github.ref_name }}.tgz" --repo "${{ github.repository }}"
389+
390+ publish-nitro-cli-npm :
391+ name : 🧱 Publish Nitro CLI to npm
392+ runs-on : ubuntu-latest
393+ needs : [publish-nitro-cli-platforms]
394+ if : startsWith(github.ref, 'refs/tags/')
395+ permissions :
396+ contents : write
397+ id-token : write
389398
399+ steps :
400+ - name : 📦 Checkout
401+ uses : actions/checkout@v6
402+
403+ - name : 🧰 Setup Node
404+ uses : actions/setup-node@v6
405+ with :
406+ node-version : 24
407+ registry-url : ${{ vars.NPM_REGISTRY_URL }}
408+ scope : " @chillicream"
409+
410+ - name : 🏷 Get the version from tag
411+ run : echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
412+
413+ - name : 🏷 Compute dist-tag
414+ shell : bash
415+ run : |
390416 if [[ "$GIT_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
391- DIST_TAG="latest"
417+ echo "DIST_TAG=latest" >> $GITHUB_ENV
418+ elif [[ "$GIT_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\. ]]; then
419+ echo "DIST_TAG=rc" >> $GITHUB_ENV
392420 else
393- DIST_TAG=" preview"
421+ echo " DIST_TAG=preview" >> $GITHUB_ENV
394422 fi
395423
396- npm publish "./${TARBALL}" --access public --registry=${{ vars.NPM_REGISTRY_URL }} --tag "${DIST_TAG}"
424+ - name : 🧰 Enable corepack
425+ run : corepack enable
426+
427+ - name : 📥 Install dependencies
428+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro
429+ run : yarn install --immutable
430+
431+ - name : 🏗️ Build
432+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro
433+ run : yarn build
434+
435+ - name : 🏷️ Bump version and inject optionalDependencies
436+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro
397437 shell : bash
438+ run : |
439+ set -euo pipefail
440+ npm version "$GIT_TAG" --no-git-tag-version --allow-same-version
441+ jq --arg v "$GIT_TAG" '
442+ .optionalDependencies = {
443+ "@chillicream/nitro-linux-arm64": $v,
444+ "@chillicream/nitro-linux-musl-x64": $v,
445+ "@chillicream/nitro-linux-x64": $v,
446+ "@chillicream/nitro-osx-arm64": $v,
447+ "@chillicream/nitro-osx-x64": $v,
448+ "@chillicream/nitro-win-x64": $v,
449+ "@chillicream/nitro-win-x86": $v
450+ }
451+ ' package.json > package.json.tmp
452+ mv package.json.tmp package.json
453+
454+ - name : 📦 Create tarball
455+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro
456+ run : npm pack
457+
458+ - name : 🚀 Publish tarball to npm
459+ working-directory : src/Nitro/CommandLine/src/npm/chillicream-nitro
460+ shell : bash
461+ run : |
462+ npm publish "./chillicream-nitro-${GIT_TAG}.tgz" \
463+ --access public \
464+ --registry="${{ vars.NPM_REGISTRY_URL }}" \
465+ --tag "${DIST_TAG}"
398466
399467 - name : 📤 Upload tarball as artifact
400468 uses : actions/upload-artifact@v7
401469 with :
402470 name : chillicream-nitro-${{ env.GIT_TAG }}.tgz
403- path : src/Nitro/CommandLine/src/chillicream-nitro/chillicream-nitro-${{ env.GIT_TAG }}.tgz
471+ path : src/Nitro/CommandLine/src/npm/ chillicream-nitro/chillicream-nitro-${{ env.GIT_TAG }}.tgz
404472
405473 - name : 📤 Attach tarball to GitHub release
406474 env :
407475 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
408- working-directory : src/Nitro/CommandLine/src/chillicream-nitro
476+ working-directory : src/Nitro/CommandLine/src/npm/ chillicream-nitro
409477 run : |
410478 gh release upload "${{ github.ref_name }}" "chillicream-nitro-${{ github.ref_name }}.tgz" --repo "${{ github.repository }}"
411479
0 commit comments