Skip to content
This repository was archived by the owner on Jul 21, 2026. It is now read-only.

Bump version to 3.0.3 in package.json (#83) #29

Bump version to 3.0.3 in package.json (#83)

Bump version to 3.0.3 in package.json (#83) #29

name: Tag, Release, and Publish on Push
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.27.0
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test
- name: Read version from package.json
id: get_version
run: |
version=$(node -p "require('./package.json').version")
echo "version=v$version" >> $GITHUB_OUTPUT
- name: Check if tag already exists
run: |
git fetch --tags
if git rev-parse ${{ steps.get_version.outputs.version }} >/dev/null 2>&1; then
echo "::error::Tag ${{ steps.get_version.outputs.version }} already exists. Did you forget to bump the version in package.json?"
exit 1
fi
- name: Create Git tag
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ steps.get_version.outputs.version }}
git push origin ${{ steps.get_version.outputs.version }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
body: Automated release for version ${{ steps.get_version.outputs.version }}.
draft: false
prerelease: false
- name: Determine npm dist-tag
id: npm_tag
run: |
version=$(node -p "require('./package.json').version")
tag=latest
if [[ "$version" == *-* ]]; then
tag=$(echo "$version" | cut -d- -f2 | cut -d. -f1)
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Publish to npm
run: pnpm publish --access public --provenance --tag ${{ steps.npm_tag.outputs.tag }}