Skip to content

Publish to NPM

Publish to NPM #6

Workflow file for this run

name: publish
run-name: Publish to NPM
on:
push:
tags:
- "*"
jobs:
release:
name: Release
runs-on: ubuntu-22.04
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: "npm"
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Get tag version
id: get_version
run: |
VERSION_TAG=${GITHUB_REF#refs/tags/}
echo "VERSION=${VERSION_TAG}" >> $GITHUB_ENV
- name: Update package.json
run: npm version ${{ env.VERSION }} --no-git-tag-version --allow-same-version
- name: Install dependencies
run: npm ci
- name: Build the package
run: npm run build
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}