Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Release
run-name: ${{ github.workflow }} v${{ inputs.version }}
on:
workflow_dispatch:
inputs:
version:
description: 'Bump version (e.g., 0.1.0, 0.2.0-alpha.1, 1.0.0-beta.2)'
required: true
type: string
tag:
description: 'npm dist-tag to publish under (leave empty to fallback to preid, or "latest" for stable)'
required: false
type: string
skip_git_check:
description: Skip git checks when publishing (--no-git-checks)
required: false
type: boolean
default: false
skip_bump:
description: Skip version bump (bumpp) step
required: false
type: boolean
default: false
skip_changelog:
description: Skip changelog generation (changelogithub) step
required: false
type: boolean
default: false

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- id: version
run: |
VERSION="${{ github.event.inputs.version }}"

if [[ $VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([a-z]+)\.([1-9][0-9]*))?$ ]]; then
if [[ "${BASH_REMATCH[5]}" == "latest" ]]; then
echo "INVALID VERSION FORMAT ('latest' is not allowed): $VERSION" >&2
exit 1
fi

echo "major=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
echo "minor=${BASH_REMATCH[2]}" >> $GITHUB_OUTPUT
echo "patch=${BASH_REMATCH[3]}" >> $GITHUB_OUTPUT
echo "preid=${BASH_REMATCH[5]}" >> $GITHUB_OUTPUT
echo "number=${BASH_REMATCH[6]}" >> $GITHUB_OUTPUT
else
echo "INVALID VERSION FORMAT: $VERSION" >&2
exit 1
fi

- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: pnpm/action-setup@v6

- run: pnpm i

- run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- run: pnpm exec bumpp -r ${{ github.event.inputs.version }} --yes
if: ${{ github.event.inputs.skip_bump != 'true' }}

- run: pnpm exec changelogithub --draft
if: ${{ github.event.inputs.skip_changelog != 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: pnpm --filter='./packages/*' publish -r --provenance --access=public --tag=${{ github.event.inputs.tag || steps.version.outputs.preid || 'latest' }} ${{ github.event.inputs.skip_git_check == 'true' && '--no-git-checks' || '' }}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"@seriousme/openapi-schema-validator": "^2.9.1",
"@types/node": "^26.4.0",
"@vitest/coverage-v8": "^4.1.11",
"bumpp": "^12.3.0",
"changelogithub": "^15.0.5",
"eslint": "^10.10.0",
"eslint-plugin-format": "^2.0.1",
"lint-staged": "^17.4.1",
Expand Down
Loading