Skip to content

Release

Release #5

Workflow file for this run

# 手动发布到 npm 和 GitHub Releases
name: Release
on:
# 手动触发发布
workflow_dispatch:
inputs:
version:
description: '发布版本类型'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
# 权限设置
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Configure Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Run quality checks
run: |
npm run typecheck
npm run lint
- name: Build
run: npm run build:prod
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "🚀 开始发布 ${{ github.event.inputs.version }} 版本..."
npm run release:${{ github.event.inputs.version }}
echo "🎉 发布完成!"