Skip to content

feat: add manual release workflow with input validation #21

feat: add manual release workflow with input validation

feat: add manual release workflow with input validation #21

Workflow file for this run

name: Reusable Node (pnpm) CI

Check failure on line 1 in .github/workflows/node-pnpm.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/node-pnpm.yml

Invalid workflow file

(Line: 61, Col: 13): Unrecognized named-value: 'secrets'. Located at position 30 within expression: inputs.registry-url != '' && secrets.NPM_TOKEN != ''
on:
workflow_call:
inputs:
node-version:
description: Node.js version
required: false
type: string
pnpm-version:
description: pnpm version
required: false
type: string
working-directory:
description: Directory with package.json
required: false
type: string
default: "."
frozen-lockfile:
description: Use --frozen-lockfile
required: false
type: boolean
default: true
build-script:
description: Name of build script to run
required: false
type: string
default: "build"
test-script:
description: Name of test script to run
required: false
type: string
default: "test"
test-args:
description: Additional args to pass to test script
required: false
type: string
default: ""
registry-url:
description: Optional npm registry URL
required: false
type: string
default: ""
secrets:
NPM_TOKEN:
required: false
env:
NODE_VERSION: ${{ inputs.node-version || '20' }}
PNPM_VERSION: ${{ inputs.pnpm-version || '9' }}
jobs:
node:
name: Node (pnpm) Build & Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Configure npm auth (if token provided)
if: ${{ inputs.registry-url != '' && secrets.NPM_TOKEN != '' }}
shell: bash
run: |
set -euo pipefail
REG="${{ inputs.registry-url }}"
HOST=$(echo "$REG" | sed -E 's#^https?://##')
case "$HOST" in
*/) ;;
*) HOST="$HOST/" ;;
esac
npm config set //${HOST}:_authToken="${{ secrets.NPM_TOKEN }}"
- name: Setup Node & pnpm
uses: ./.github/actions/pnpm-setup
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
registry-url: ${{ inputs.registry-url }}
- name: Install
uses: ./.github/actions/pnpm-install
with:
working-directory: ${{ inputs.working-directory }}
frozen-lockfile: ${{ inputs.frozen-lockfile }}
- name: Build
uses: ./.github/actions/pnpm-build
with:
working-directory: ${{ inputs.working-directory }}
script: ${{ inputs.build-script }}
- name: Test
uses: ./.github/actions/node-test
with:
working-directory: ${{ inputs.working-directory }}
script: ${{ inputs.test-script }}
args: ${{ inputs.test-args }}