Skip to content

Release

Release #1

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version bump type
required: true
default: patch
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: npm pack --dry-run
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Bump version
run: npm version ${{ github.event.inputs.version }}
- name: Push tag and commit
run: git push --follow-tags
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version=$(node -p "require('./package.json').version")
prev_tag=$(git tag --sort=-version:refname | grep '^v' | sed -n '2p')
if [ -n "$prev_tag" ]; then
echo "## What's Changed" > .release-notes.md
git log --oneline --no-decorate "${prev_tag}..HEAD" -- . >> .release-notes.md
gh release create "v${version}" --title "v${version}" -F .release-notes.md
rm .release-notes.md
else
gh release create "v${version}" --title "v${version}" --generate-notes
fi
- name: Upgrade npm & publish
run: |
npm install -g npm@latest
unset NODE_AUTH_TOKEN
npm publish --provenance --access public