Skip to content

bump version

bump version #11

Workflow file for this run

name: Release
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write # for OIDC
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v5
with:
node-version: 24.x
cache: npm
- run: npm ci
- run: npm run lint
- name: Read package version
id: pkg
shell: bash
run: |
VERSION=$(node -p "require('./package.json').version")
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
- name: Check existing tag
id: tag_check
uses: actions/github-script@v7
env:
TAG_NAME: ${{ steps.pkg.outputs.tag }}
with:
script: |
const tag = process.env.TAG_NAME;
try {
await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tag}`
});
core.setOutput("exists", "true");
} catch (error) {
if (error.status === 404) {
core.setOutput("exists", "false");
} else {
throw error;
}
}
- name: Create GitHub release
if: steps.tag_check.outputs.exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.pkg.outputs.tag }}
release_name: ${{ steps.pkg.outputs.tag }}
body: "Automated release for ${{ steps.pkg.outputs.tag }}."
- name: Configure npmjs registry
if: steps.tag_check.outputs.exists == 'false'
uses: actions/setup-node@v5
with:
node-version: 24.x
registry-url: https://registry.npmjs.org
- name: Publish to npm (npmjs.org)
if: steps.tag_check.outputs.exists == 'false'
run: npm publish --provenance --access public