Build - chore(deps): bump actions/setup-node from 3.9.1 to 5.0.0 #447
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Release | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "fs-metadata release: bump version (current = use package.json)" | |
required: false | |
type: choice | |
default: "current" | |
options: | |
- current | |
- patch | |
- minor | |
- major | |
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Release - {0}', github.event.inputs.version) || format('Build - {0}', github.event.head_commit.message || github.event.pull_request.title) }} | |
jobs: | |
lint: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-24.04, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
# Linux-specific dependencies | |
- if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y clang-tidy bear build-essential libglib2.0-dev libblkid-dev uuid-dev | |
# Windows clang-tidy installation | |
- if: runner.os == 'Windows' | |
run: | | |
# Check if clang-tidy is available in common locations | |
$found = $false | |
$paths = @( | |
"C:\Program Files\LLVM\bin\clang-tidy.exe", | |
"C:\Program Files (x86)\LLVM\bin\clang-tidy.exe" | |
) | |
foreach ($path in $paths) { | |
if (Test-Path $path) { | |
Write-Host "Found clang-tidy at: $path" | |
$found = $true | |
break | |
} | |
} | |
if (-not $found) { | |
Write-Host "Installing LLVM/clang-tidy..." | |
# Install via Chocolatey (available on GitHub runners) | |
choco install llvm -y | |
# Refresh PATH | |
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
} | |
# Verify installation | |
clang-tidy --version | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: 20 | |
cache: "npm" | |
- run: npm ci --ignore-scripts | |
# Run linting - the scripts handle platform differences | |
- run: npm run lint | |
prebuild-mac-x64: | |
runs-on: macos-13-large # Intel x64 runner | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: 20 | |
cache: "npm" | |
# We need to ignore scripts so the `install` script in package.json does | |
# not run node-gyp-build | |
- run: npm ci --ignore-scripts | |
- run: npm run build:native | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: prebuilds-macos-13-large | |
path: prebuilds/ | |
prebuild-mac-arm64: | |
runs-on: macos-14 # Apple Silicon ARM64 runner (default for macos-14) | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: 20 | |
cache: "npm" | |
# We need to ignore scripts so the `install` script in package.json does | |
# not run node-gyp-build | |
- run: npm ci --ignore-scripts | |
- run: npm run build:native | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: prebuilds-macos-14 | |
path: prebuilds/ | |
prebuild-win-x64: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: 20 | |
cache: "npm" | |
# We need to ignore scripts so the `install` script in package.json does | |
# not run node-gyp-build | |
- run: npm ci --ignore-scripts | |
- run: npm run build:native | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: prebuilds-windows-latest | |
path: prebuilds/ | |
prebuild-win-arm64: | |
runs-on: windows-11-arm | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: 20 | |
cache: "npm" | |
# We need to ignore scripts so the `install` script in package.json does | |
# not run node-gyp-build | |
- run: npm ci --ignore-scripts | |
- run: npm run build:native | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: prebuilds-windows-11-arm | |
path: prebuilds/ | |
prebuild-linux-glibc: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64, arm64] | |
runs-on: ubuntu-24.04 # Use newer runner for Docker support | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: ./.github/actions/setup-qemu | |
with: | |
arch: ${{ matrix.arch }} | |
# Build in Debian 11 Bullseye container for GLIBC 2.31 compatibility | |
# This ensures compatibility with Ubuntu 20.04+ and modern Node.js Docker images | |
# Note: npm ci is run inside the container by the build:linux-glibc script | |
- run: TARGET_ARCH=${{ matrix.arch }} npm run build:linux-glibc | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: prebuilds-linux-${{ matrix.arch }}-glibc | |
path: prebuilds/ | |
prebuild-linux-musl: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64, arm64] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: ./.github/actions/setup-qemu | |
with: | |
arch: ${{ matrix.arch }} | |
- run: | | |
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch == 'x64' && 'amd64' || 'arm64' }} node:20-alpine3.21 -c "\ | |
apk add build-base git python3 py3-setuptools util-linux-dev --update-cache && \ | |
cd /tmp/project && \ | |
npm ci --ignore-scripts && \ | |
npm run build:native" | |
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
with: | |
name: prebuilds-linux-${{ matrix.arch }}-musl | |
path: prebuilds/ | |
test-mac-x64: | |
needs: [prebuild-mac-x64] | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20, 22, 24] | |
runs-on: macos-13-large # Intel x64 runner | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: npm ci | |
- run: npm run tests | |
test-mac-arm64: | |
needs: [prebuild-mac-arm64] | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20, 22, 24] | |
runs-on: macos-14 # Apple Silicon ARM64 runner | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: npm ci | |
- run: npm run tests | |
test-win-x64: | |
needs: [prebuild-win-x64] | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20, 22, 24] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: npm ci | |
- run: npm run tests | |
test-win-arm64: | |
needs: [prebuild-win-arm64] | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [20, 22, 24] | |
runs-on: windows-11-arm | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- run: npm ci | |
- run: npm run tests | |
test-ubuntu: | |
needs: [prebuild-linux-glibc] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, ubuntu-24.04] | |
arch: [x64, arm64] | |
node-version: [20, 22, 24] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: ./.github/actions/setup-qemu | |
with: | |
arch: ${{ matrix.arch }} | |
- run: sudo apt-get update | |
- run: sudo apt-get install -y libglib2.0-dev libblkid-dev uuid-dev | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- run: npm ci | |
- run: npm run tests | |
test-alpine: | |
needs: [prebuild-linux-musl] | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [x64, arm64] | |
node-version: [20, 22, 24] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
- uses: ./.github/actions/setup-qemu | |
with: | |
arch: ${{ matrix.arch }} | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- run: | | |
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch == 'x64' && 'amd64' || 'arm64' }} node:${{ matrix.node-version }}-alpine -c "\ | |
apk add util-linux-dev bash valgrind --update-cache && \ | |
cd /tmp/project && \ | |
npm ci && \ | |
npm run tests" | |
publish: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-24.04 | |
needs: | |
[ | |
test-mac-x64, | |
test-mac-arm64, | |
test-win-x64, | |
test-win-arm64, | |
test-ubuntu, | |
test-alpine, | |
lint, | |
] | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
# Fetch full history for proper git operations | |
fetch-depth: 0 | |
- uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0 | |
with: | |
path: ./prebuilds | |
merge-multiple: true | |
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: lts/* | |
cache: "npm" | |
registry-url: "https://registry.npmjs.org" | |
- uses: photostructure/git-ssh-signing-action@a770c2ff3aea31d9df9f2974ac9d672f2bfe62f3 # v1.1.0 | |
with: | |
ssh-signing-key: ${{ secrets.SSH_SIGNING_KEY }} | |
git-user-name: ${{ secrets.GIT_USER_NAME }} | |
git-user-email: ${{ secrets.GIT_USER_EMAIL }} | |
- run: ls -laR ./prebuilds | |
- run: npm ci | |
- run: npm run prepare-release | |
- name: Version and tag release | |
run: | | |
# Handle version bump based on input | |
if [ "${{ github.event.inputs.version }}" = "current" ]; then | |
# Use the version from package.json, stripping any pre-release suffix | |
RELEASE_VERSION=$(node -p "require('./package.json').version.replace(/-.*$/, '')") | |
npm version $RELEASE_VERSION --message "release: %s" | |
else | |
# Normal version bump (patch, minor, major) | |
npm version ${{ github.event.inputs.version }} --message "release: %s" | |
fi | |
# Get the new version for later use | |
NEW_VERSION=$(node -p "require('./package.json').version") | |
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#environment-files | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
- name: Publish to npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Push the version commit and tag | |
git push origin main --follow-tags | |
# Create GitHub release | |
gh release create "v$NEW_VERSION" \ | |
--title "Release v$NEW_VERSION" \ | |
--generate-notes \ | |
--verify-tag |