Skip to content

Publish to npm

Publish to npm #16

Workflow file for this run

name: Publish to npm
# Trigger when a new release is created
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
scope: '@kispace-io'
- name: Update npm
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci
- name: Extract version from release
id: version
run: |
TAG="${{ github.event.release.tag_name }}"
VERSION=${TAG#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION from release tag: $TAG"
- name: Update package.json version (CI only, not committed)
run: |
npm version "${{ steps.version.outputs.version }}" --no-git-tag-version
echo "Updated package.json version to ${{ steps.version.outputs.version }} (CI only, will not be committed)"
- name: Build package
run: npm run build
- name: Run type check
run: npm run type-check
continue-on-error: true
- name: Publish to npm
run: npm publish --access public