Publish to NPM #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |