Skip to content

Improve github action #4

Improve github action

Improve github action #4

Workflow file for this run

name: Build and Publish to npm
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Update package.json version
run: npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Build
run: npm run build
- name: Verify build output
run: |
echo "📦 Publishing version ${{ steps.version.outputs.VERSION }}"
ls -la dist/
- name: Publish to npm
run: npm publish --provenance --access public