Skip to content

- 设置项可自定义每个标题级别的序号 #16

- 设置项可自定义每个标题级别的序号

- 设置项可自定义每个标题级别的序号 #16

Workflow file for this run

name: Release Workflow
on:
push:
branches:
- main
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Dependencies and Build
id: build
run: |
npm install -g pnpm && pnpm install && pnpm run build
echo "zip_path=$(pwd)/package.zip" >> $GITHUB_OUTPUT
- name: Get Current Version
id: version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Release
run: |
current_version="${{ steps.version.outputs.version }}"
if git rev-parse -q --verify "refs/tags/v$current_version"; then
echo "Release $current_version already exists. Nothing to do."
exit 0
fi
commit_message=$(git log -1 --pretty=%B)
release_title="v$current_version"
echo "Creating release $release_title"
gh release create $release_title ${{ steps.build.outputs.zip_path }} -t $release_title -n "$commit_message"