Skip to content

Commit 5bc12b0

Browse files
chore: 更新版本流水线
1 parent 792777d commit 5bc12b0

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: '版本号 (例如: v1.9.0)'
11+
required: true
12+
type: string
713

814
permissions:
915
contents: write
@@ -15,11 +21,13 @@ jobs:
1521
runs-on: ubuntu-latest
1622
steps:
1723
- uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.inputs.version || github.ref }}
1826

19-
- uses: actions/setup-node@v4
27+
- uses: actions/setup-node@v6
2028
with:
21-
node-version: '20.x'
22-
registry-url: 'https://registry.npmjs.org'
29+
node-version: "24"
30+
registry-url: "https://registry.npmjs.org"
2331

2432
- name: Setup Bun
2533
uses: oven-sh/setup-bun@v2
@@ -46,13 +54,11 @@ jobs:
4654
- name: Generate changelog
4755
id: changelog
4856
run: |
49-
PREV_TAG=$(git tag --sort=-version:refname | head -2 | tail -1)
50-
if [ "$PREV_TAG" = "$GITHUB_REF_NAME" ]; then
51-
PREV_TAG=""
52-
fi
57+
VERSION="${{ github.event.inputs.version || github.ref_name }}"
58+
PREV_TAG=$(git tag --sort=-version:refname | grep -v "^${VERSION#v}$" | head -1)
5359
5460
if [ -n "$PREV_TAG" ]; then
55-
COMMITS=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges)
61+
COMMITS=$(git log "${PREV_TAG}..${VERSION}" --pretty=format:"- %s (%h)" --no-merges)
5662
else
5763
COMMITS=$(git log --pretty=format:"- %s (%h)" --no-merges -20)
5864
fi
@@ -66,12 +72,12 @@ jobs:
6672
- name: Create GitHub Release
6773
uses: softprops/action-gh-release@v2
6874
with:
69-
name: ${{ github.ref_name }}
75+
name: ${{ github.event.inputs.version || github.ref_name }}
7076
body: |
7177
## What's Changed
7278
7379
${{ steps.changelog.outputs.commits }}
7480
75-
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.ref_name }}^...${{ github.ref_name }}
81+
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.event.inputs.version || github.ref_name }}^...${{ github.event.inputs.version || github.ref_name }}
7682
draft: false
77-
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
83+
prerelease: ${{ contains(github.event.inputs.version || github.ref_name, 'rc') || contains(github.event.inputs.version || github.ref_name, 'beta') || contains(github.event.inputs.version || github.ref_name, 'alpha') }}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"lint": "biome lint src/",
5252
"lint:fix": "biome lint --fix src/",
5353
"format": "biome format --write src/",
54-
"prepare": "git config core.hooksPath .githooks",
5554
"test": "bun test",
5655
"test:production": "bun run scripts/production-test.ts",
5756
"test:production:offline": "bun run scripts/production-test.ts --offline",

0 commit comments

Comments
 (0)