Skip to content

ci: upgrade to Node 22 and npm 11.5.1+ for OIDC trusted publishing #8

ci: upgrade to Node 22 and npm 11.5.1+ for OIDC trusted publishing

ci: upgrade to Node 22 and npm 11.5.1+ for OIDC trusted publishing #8

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- 'v*' # Trigger on version tags like v3.0.0, v3.1.0, etc.
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # Required for creating GitHub releases
id-token: write # Required for npm trusted publishing (OIDC)
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22' # Node 22 for npm 11.5.1+ (required for OIDC)
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
- name: Upgrade npm for OIDC support
run: |
npm install -g npm@latest
npm --version
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:lib -- --watch=false --browsers=ChromeHeadless
- name: Build production library
run: npm run build-prod:lib
- name: Copy files to dist
run: |
npm run copy:readme
npm run copy:changelog
npm run copy:license
- name: Determine npm tag
id: npm-tag
run: |
VERSION=$(node -p "require('./package.json').version")
if [[ "$VERSION" == *"beta"* ]] || [[ "$VERSION" == *"alpha"* ]] || [[ "$VERSION" == *"rc"* ]]; then
echo "tag=next" >> $GITHUB_OUTPUT
else
echo "tag=latest" >> $GITHUB_OUTPUT
fi
- name: Publish to npm (Trusted Publishing via OIDC)
run: npm publish ./dist/angular-editor --tag ${{ steps.npm-tag.outputs.tag }} --provenance --access public
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}