Skip to content

chore: release v2.9.1 #56

chore: release v2.9.1

chore: release v2.9.1 #56

Workflow file for this run

name: Publish to npm
on:
push:
tags:
- 'v*'
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'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint --if-present
- name: Run tests
run: npm test --if-present
- name: Build package
run: npm run build
- name: Verify package contents
run: |
echo "Package contents:"
npm pack --dry-run
- name: Check if version matches tag
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION=${GITHUB_REF#refs/tags/v}
echo "Package version: $PACKAGE_VERSION"
echo "Tag version: $TAG_VERSION"
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "❌ Version mismatch: package.json ($PACKAGE_VERSION) != tag ($TAG_VERSION)"
exit 1
fi
echo "✅ Version matches tag"
- name: Publish to npm
run: |
if [[ "${{ github.ref }}" == *"alpha"* ]] || [[ "${{ github.ref }}" == *"beta"* ]] || [[ "${{ github.ref }}" == *"rc"* ]]; then
npm publish --tag next
echo "📦 Published as pre-release (next tag)"
else
npm publish --tag latest
echo "📦 Published as stable release (latest tag)"
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}