Skip to content

Release

Release #19

Workflow file for this run

name: Release
on:
repository_dispatch:
types: [openapi-updated]
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
version_bump:
description: 'patch | minor | major'
required: false
default: 'patch'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- name: Regenerate SDK
run: bun run generate
- name: Check if spec changed
id: diff
run: |
if git diff --quiet specs/openapi.json; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Build
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run build
- name: Test
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: bun run test
- name: Bump version and rebuild
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
npm version ${{ github.event.inputs.version_bump || 'patch' }} --no-git-tag-version
VERSION=$(node -p "require('./package.json').version")
echo "export const VERSION = '$VERSION';" > src/version.ts
bun run build
- name: Publish to npm
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
npm install -g npm@latest
npm publish --access public --provenance
- name: Commit, tag, push
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
VERSION=$(node -p "require('./package.json').version")
git add package.json src/version.ts specs/openapi.json src/
git commit -m "release: v$VERSION"
git tag "v$VERSION"
git push --follow-tags