Files
ci/setup-node/action.yml
T
ozan 5f0ddc1901 feat: composite actions + runner base image
Actions: checkout, setup-go, setup-node, setup-aws
Runner image: Go 1.26 + Node 22 + AWS CLI + Docker (docker:29-dind)
2026-05-22 17:52:08 +01:00

40 lines
1.1 KiB
YAML

name: 'Tinqs Setup Node'
description: 'Install Node.js and pnpm (replaces actions/setup-node)'
inputs:
node-version:
description: 'Node.js major version'
default: '22'
pnpm:
description: 'Install pnpm (true/false)'
default: 'true'
runs:
using: 'composite'
steps:
- run: |
NODE_VERSION="${{ inputs.node-version }}"
INSTALL_PNPM="${{ inputs.pnpm }}"
# Skip if already installed at correct major version
if command -v node &>/dev/null; then
CURRENT=$(node --version | grep -oP '\d+' | head -1)
if [ "$CURRENT" = "$NODE_VERSION" ]; then
echo "Node $NODE_VERSION already installed"
node --version
[ "$INSTALL_PNPM" = "true" ] && command -v pnpm &>/dev/null && pnpm --version && exit 0
fi
fi
echo "Installing Node.js $NODE_VERSION..."
curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash -
apt-get install -y nodejs
if [ "$INSTALL_PNPM" = "true" ]; then
npm install -g pnpm
pnpm --version
fi
node --version
shell: bash