better-setup-node v1: pinned musl node + corepack pnpm

This commit is contained in:
2026-10-31 08:51:21 +02:00
commit f1e8278b45
2 changed files with 47 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
# better-setup-node
Fork of the setup-node recipe for git.madapes.com runners. The runner images are musl-based,
so the official (glibc) Node builds fail with `no such file or directory` on exec — this
installs the pinned musl build from the official unofficial-builds mirror. When
`pnpm-version` is set, corepack (bundled with Node) activates that exact pnpm.
```yaml
- uses: https://git.madapes.com/actions/better-setup-node@v1
with: { node-version: "22.14.0", pnpm-version: "10.33.0" }
```
+36
View File
@@ -0,0 +1,36 @@
name: better-setup-node
description: Install a pinned musl Node from the official unofficial-builds (glibc builds cannot exec on musl runners) and optionally activate a pinned pnpm via corepack.
inputs:
node-version:
description: Exact Node version to install (e.g. 22.14.0).
required: true
pnpm-version:
description: Optional exact pnpm version to activate via corepack.
required: false
default: ""
runs:
using: composite
steps:
- shell: bash
run: |
set -euo pipefail
nv="${{ inputs.node-version }}"
pv="${{ inputs.pnpm-version }}"
need_install=0
node --version 2>/dev/null | grep -q "^v${nv%%.*}\." || need_install=1
[ "$need_install" = 0 ] && [ -n "$pv" ] && command -v corepack >/dev/null || need_install=1
if [ "$need_install" = 1 ]; then
case "$(uname -m)" in
x86_64|amd64) musl=x64-musl ;;
aarch64|arm64) musl=arm64-musl ;;
*) echo "better-setup-node: unsupported arch $(uname -m)" >&2; exit 1 ;;
esac
curl -fsSL "https://unofficial-builds.nodejs.org/download/release/v${nv}/node-v${nv}-linux-${musl}.tar.gz" \
| tar -xz -C /usr/local --strip-components=1
fi
node --version
if [ -n "$pv" ]; then
corepack enable
corepack prepare "pnpm@${pv}" --activate
pnpm --version
fi