Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 58 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,64 @@ jobs:
api-key: ${{ secrets.NITRO_API_KEY }}
comment-mode: "review"

verify-nitro-npm-package:
name: Verify Nitro npm package
runs-on: ubuntu-latest
needs: check-changes
if: needs.check-changes.outputs.src_changes == 'true'
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
show-progress: false

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24

- 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: Inject optionalDependencies
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
shell: bash
run: |
set -euo pipefail
jq --arg v "0.0.0-ci" '
.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: Pack
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro
run: npm pack --dry-run

ci-status-check:
name: "CI Status Check"
needs: [library-tests, website-tests, validate-nitro-client]
needs:
[
library-tests,
website-tests,
validate-nitro-client,
verify-nitro-npm-package,
]
if: always()
runs-on: ubuntu-latest
steps:
Expand All @@ -308,4 +363,5 @@ jobs:
if: |
always() &&
(needs.library-tests.result == 'failure' ||
needs.website-tests.result == 'failure')
needs.website-tests.result == 'failure' ||
needs.verify-nitro-npm-package.result == 'failure')
206 changes: 137 additions & 69 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ jobs:
strategy:
matrix:
include:
# Linux (x64)
# Linux
- os: ubuntu-22.04
rid: linux-x64
- os: ubuntu-22.04
rid: linux-musl-x64
# Linux (arm64 on ARM runner!)
- os: ubuntu-24.04-arm
rid: linux-arm64
# macOS
Expand All @@ -117,7 +116,7 @@ jobs:
rid: win-x64
- os: windows-2025
rid: win-x86
# Windows (arm64 on ARM runner!)
# Commented, since azure/artifact-signing-action does not currently support ARM.
# - os: windows-11-arm
# rid: win-arm64

Expand All @@ -137,8 +136,8 @@ jobs:

- name: 🏷 Get the version from tag (Unix)
if: runner.os != 'Windows'
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
shell: bash
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: 📦 Publish binary (Windows)
if: runner.os == 'Windows'
Expand All @@ -152,9 +151,9 @@ jobs:

- name: 📦 Publish binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
./build.sh publishaot --SemVersion $GIT_TAG --RuntimeIdentifier ${{ matrix.rid }} --Configuration Release
shell: bash
env:
NitroApiClientId: ${{ secrets.NITRO_API_CLIENT_ID }}
NitroIdentityClientId: ${{ secrets.NITRO_IDENTITY_CLIENT_ID }}
Expand Down Expand Up @@ -238,15 +237,15 @@ jobs:

- name: 📦 Zip binary (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
zip -j nitro-${{ matrix.rid }}.zip publish/nitro
shell: bash

- name: 📦 Tar binary (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
tar -czf nitro-${{ matrix.rid }}.tar.gz -C publish nitro
shell: bash

- name: 🖋️ Notarize binary (macOS)
if: runner.os == 'macOS'
Expand Down Expand Up @@ -296,14 +295,31 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-nitro-cli-npm:
name: 🧱 Publish Nitro CLI to npm
publish-nitro-cli-platforms:
name: 🧱 Publish Nitro CLI (${{ matrix.rid }}) to npm
runs-on: ubuntu-latest
needs: [build-nitro-cli]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
id-token: write
strategy:
matrix:
include:
- rid: linux-x64
binary: nitro
- rid: linux-musl-x64
binary: nitro
- rid: linux-arm64
binary: nitro
- rid: osx-x64
binary: nitro
- rid: osx-arm64
binary: nitro
- rid: win-x64
binary: nitro.exe
- rid: win-x86
binary: nitro.exe

steps:
- name: 📦 Checkout
Expand All @@ -316,96 +332,148 @@ jobs:
registry-url: ${{ vars.NPM_REGISTRY_URL }}
scope: "@chillicream"

- name: 🧰 Enable corepack
run: corepack enable

- name: 📥 Download all packaged nitro binaries
- name: 📥 Download nitro binary
uses: actions/download-artifact@v8
with:
pattern: nitro-*
merge-multiple: true
path: dist-archives
name: nitro-${{ matrix.rid }}
path: dist

- name: 🏷 Get the version from tag
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: 🗂️ Move binaries to npm package
- name: 🗂️ Stage binary in package directory
shell: bash
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
run: |
PACKAGE_DIR="src/Nitro/CommandLine/src/chillicream-nitro"

for archive in dist-archives/nitro-*; do
base=$(basename "$archive")

case "$base" in
nitro-*.zip)
rid=${base#nitro-}
rid=${rid%.zip}
echo "Unpacking $archive -> $PACKAGE_DIR/$rid"
mkdir -p "$PACKAGE_DIR/$rid"
unzip -q "$archive" -d "$PACKAGE_DIR/$rid"
;;
nitro-*.tar.gz)
rid=${base#nitro-}
rid=${rid%.tar.gz}
echo "Unpacking $archive -> $PACKAGE_DIR/$rid"
mkdir -p "$PACKAGE_DIR/$rid"
tar -xzf "$archive" -C "$PACKAGE_DIR/$rid"
;;
*)
echo "Skipping unknown artifact: $archive"
;;
esac
done

# Ensure unix binaries are executable
chmod +x $PACKAGE_DIR/linux-x64/nitro || true
chmod +x $PACKAGE_DIR/linux-musl-x64/nitro || true
chmod +x $PACKAGE_DIR/linux-arm64/nitro || true
chmod +x $PACKAGE_DIR/osx-x64/nitro || true
chmod +x $PACKAGE_DIR/osx-arm64/nitro || true

# Ensure cli.js is executable
chmod +x $PACKAGE_DIR/cli.js

- name: 🔍 Install dependencies
working-directory: src/Nitro/CommandLine/src/chillicream-nitro
run: yarn install --immutable

- name: 📥 Install npm@11.9.0
run: npm install -g npm@11.9.0
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.binary }}" = "nitro" ]; then
chmod +x "${{ matrix.binary }}"
fi

- name: 🏷️ Set version
working-directory: src/Nitro/CommandLine/src/chillicream-nitro
run: npm version $GIT_TAG
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/chillicream-nitro
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/chillicream-nitro
working-directory: src/Nitro/CommandLine/src/npm/chillicream-nitro-${{ matrix.rid }}
shell: bash
run: |
npm publish "./chillicream-nitro-${{ matrix.rid }}-${GIT_TAG}.tgz" \
--access public \
--registry="${{ vars.NPM_REGISTRY_URL }}"

- name: 📤 Upload tarball as artifact
uses: actions/upload-artifact@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: |
TARBALL="chillicream-nitro-${GIT_TAG}.tgz"
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: [publish-nitro-cli-platforms]
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
id-token: write

steps:
- name: 📦 Checkout
uses: actions/checkout@v6

- name: 🧰 Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: ${{ vars.NPM_REGISTRY_URL }}
scope: "@chillicream"

- name: 🏷 Get the version from tag
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: 🏷 Compute dist-tag
shell: bash
run: |
if [[ "$GIT_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
DIST_TAG="latest"
echo "DIST_TAG=latest" >> $GITHUB_ENV
elif [[ "$GIT_TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\. ]]; then
echo "DIST_TAG=rc" >> $GITHUB_ENV
else
DIST_TAG="preview"
echo "DIST_TAG=preview" >> $GITHUB_ENV
fi

npm publish "./${TARBALL}" --access public --registry=${{ vars.NPM_REGISTRY_URL }} --tag "${DIST_TAG}"
- 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
run: |
npm publish "./chillicream-nitro-${GIT_TAG}.tgz" \
--access public \
--registry="${{ vars.NPM_REGISTRY_URL }}" \
--tag "${DIST_TAG}"

- name: 📤 Upload tarball as artifact
uses: actions/upload-artifact@v7
with:
name: chillicream-nitro-${{ env.GIT_TAG }}.tgz
path: src/Nitro/CommandLine/src/chillicream-nitro/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/chillicream-nitro
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 }}"

Expand Down
17 changes: 0 additions & 17 deletions src/Nitro/CommandLine/src/chillicream-nitro/.gitignore

This file was deleted.

Loading
Loading