Skip to content

Commit ed72176

Browse files
committed
chore: 使用自定义插件解决发布内容为空的问题
1 parent e5d9be5 commit ed72176

6 files changed

Lines changed: 473 additions & 356 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ jobs:
2020
permissions:
2121
contents: write
2222
outputs:
23-
version: ${{ steps.release-it.outputs.version }}
24-
changelog: ${{ steps.changelog.outputs.changelog }}
23+
version: ${{ steps.release.outputs.version }}
24+
changelog: ${{ steps.release.outputs.changelog }}
2525
steps:
2626
- name: Checkout repository
2727
uses: actions/checkout@v7
@@ -46,10 +46,15 @@ jobs:
4646
git config user.name "${GITHUB_ACTOR}"
4747
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
4848
49-
- name: Generate changelog
50-
id: changelog
49+
- name: Run release-it
50+
id: release
5151
run: |
52-
CHANGELOG=$(pnpm release --changelog)
52+
npx release-it --ci ${{ inputs.version }} --git.tagExclude="*[-]*"
53+
54+
VERSION=$(node -p "require('./package.json').version")
55+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
56+
57+
CHANGELOG=$(awk '/^## \[/{if(c++) exit}c' CHANGELOG.md)
5358
5459
# 如果用户提供了自定义 release notes(非默认模板),则追加到 changelog 之前
5560
NOTES='${{ inputs.release_notes }}'
@@ -66,15 +71,6 @@ jobs:
6671
env:
6772
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6873

69-
- name: Run release-it
70-
id: release-it
71-
run: |
72-
pnpm release --ci ${{ inputs.version }}
73-
VERSION=$(node -p "require('./package.json').version")
74-
echo "version=${VERSION}" >> $GITHUB_OUTPUT
75-
env:
76-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
7874
build:
7975
needs: bump
8076
permissions:

.release-it.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
"./scripts/release-it-bumper.ts": {
1414
"out": [{ "file": "src-tauri/tauri.conf.json", "path": "version" }, "src-tauri/Cargo.toml"]
1515
},
16-
"@release-it/conventional-changelog": {
16+
"./scripts/conventional-changelog.ts": {
1717
"preset": {
18-
"name": "conventionalcommits",
1918
"types": [
2019
{ "type": "feat", "section": "✨ 新功能" },
2120
{ "type": "fix", "section": "🐛 Bug 修复" },

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,28 @@
5151
"@commitlint/cli": "^21.2.1",
5252
"@commitlint/config-conventional": "^21.2.0",
5353
"@commitlint/types": "^21.2.0",
54-
"@release-it/conventional-changelog": "^11.0.1",
54+
"@conventional-changelog/git-client": "^3.1.0",
5555
"@tailwindcss/vite": "^4.3.2",
5656
"@tauri-apps/cli": "^2.11.4",
5757
"@tsconfig/node24": "^24.0.4",
5858
"@types/node": "^26.1.1",
59+
"@types/semver": "^7.7.1",
5960
"@vitejs/plugin-vue": "^6.0.8",
6061
"@vitejs/plugin-vue-jsx": "^5.1.6",
6162
"@vue/eslint-config-prettier": "^10.2.0",
6263
"@vue/eslint-config-typescript": "^14.9.0",
6364
"@vue/tsconfig": "^0.9.1",
65+
"conventional-changelog": "^8.1.0",
66+
"conventional-changelog-conventionalcommits": "^10.2.1",
67+
"conventional-recommended-bump": "^12.1.0",
6468
"eslint": "^10.7.0",
6569
"eslint-plugin-vue": "^10.9.2",
6670
"husky": "^9.1.7",
6771
"lint-staged": "^17.0.8",
6872
"npm-run-all2": "^9.0.2",
6973
"prettier": "^3.9.5",
7074
"release-it": "^20.2.1",
75+
"semver": "^7.8.5",
7176
"tailwindcss": "^4.3.2",
7277
"typescript": "^6.0.3",
7378
"unplugin-auto-import": "^21.0.0",

0 commit comments

Comments
 (0)