80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version_type:
|
|
description: 'Version type (patch, minor, major)'
|
|
required: true
|
|
default: 'patch'
|
|
type: choice
|
|
options:
|
|
- patch
|
|
- minor
|
|
- major
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: latest
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
|
|
- name: Bump version
|
|
id: bump_version
|
|
run: |
|
|
# Get current version
|
|
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
echo "Current version: $CURRENT_VERSION"
|
|
|
|
# Bump version using npm version
|
|
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version
|
|
|
|
# Get new version
|
|
NEW_VERSION=$(node -p "require('./package.json').version")
|
|
echo "New version: $NEW_VERSION"
|
|
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build
|
|
run: bun run build
|
|
|
|
- name: Commit changes and publish
|
|
run: |
|
|
git add package.json
|
|
git commit -m "Release v${{ steps.bump_version.outputs.new_version }}"
|
|
git tag -a v${{ steps.bump_version.outputs.new_version }} -m "Release v${{ steps.bump_version.outputs.new_version }}"
|
|
git push origin HEAD:main
|
|
git push origin --tags
|
|
pnpm publish --no-git-checks
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|