- v6 -> v7 su tutti gli step, varianti gitea.com e -github - il breaking change della v7 (rifiuto del codice di una PR da fork su pull_request_target e workflow_run) era gia' backportato in v6.1.0, dove il tag flottante v6 puntava: il delta reale e' ESM piu' dipendenze - la guardia non si attiva comunque: serve un ref o un repository esplicito, e qui i checkout sono self-checkout nudi su workflow_call - action.yml identico fra v6.1.0 e v7.0.1, stesso using node24: nessun requisito nuovo sui runner Fixes #24 @1h30m
65 lines
1.8 KiB
YAML
65 lines
1.8 KiB
YAML
name: Publish npm Package
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
working-directory:
|
|
description: 'Cartella che contiene package.json, relativa alla root del repo. Default: la root.'
|
|
type: string
|
|
default: '.'
|
|
node-version:
|
|
type: string
|
|
default: '24.16.0'
|
|
|
|
jobs:
|
|
npm-publish:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ inputs.working-directory || '.' }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@v7
|
|
|
|
- name: Setup Node.js
|
|
uses: https://github.com/actions/setup-node@v7
|
|
with:
|
|
node-version: ${{ inputs.node-version || '24.16.0' }}
|
|
# La cache npm resta allo step actions/cache: dalla v5 setup-node la accende
|
|
# da solo se package.json ha packageManager, e la duplicherebbe.
|
|
package-manager-cache: false
|
|
|
|
- name: Cache npm
|
|
uses: https://github.com/actions/cache@v6
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Configure npm private registry
|
|
run: |
|
|
echo "@pzeta:registry=https://gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/" >> ~/.npmrc
|
|
echo "//gitea.pzetatouch.it/api/packages/PZeta_Touch/npm/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint
|
|
run: npm run lint:check
|
|
|
|
- name: Type check
|
|
run: npm run typecheck
|
|
|
|
- name: Format check
|
|
run: npm run format:check
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Test
|
|
run: npm run test
|
|
|
|
- name: Publish
|
|
run: npm publish
|