Skip to content

Commit 62f7efc

Browse files
committed
chore: 使用 softprops/action-gh-release 自动创建发布页
1 parent 4e8f420 commit 62f7efc

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ jobs:
1010
if: startsWith(github.event.head_commit.message , 'chore(release):')
1111
permissions:
1212
id-token: write
13-
contents: read
13+
contents: write
1414
env:
1515
NODE_OPTIONS: '--max-old-space-size=8192'
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
with:
19-
fetch-depth: '0'
19+
fetch-depth: 0
2020

2121
- name: Use Node.js
22-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
2323
with:
2424
node-version: 20
2525
registry-url: 'https://registry.npmjs.org/'
@@ -28,20 +28,32 @@ jobs:
2828
run: npm install
2929

3030
- name: lint
31-
run: |
32-
npm run lint
31+
run: npm run lint
3332

3433
- name: build
35-
run: |
36-
npm run build
34+
run: npm run build
3735
env:
3836
CI: false
3937

4038
- name: test
41-
run: |
42-
npm run test
39+
run: npm run test
4340

44-
- name: Release
41+
- name: Get Version from package.json
42+
id: get_version
43+
run: echo "VERSION=$$(node -p "require('./package.json').version")" >> $$GITHUB_OUTPUT
44+
45+
- name: Publish to npm
46+
run: npm publish --provenance --access public
47+
env:
48+
CI: true
49+
50+
- name: Create GitHub Release
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
tag_name: v${{ steps.get_version.outputs.VERSION }}
54+
name: Release v${{ steps.get_version.outputs.VERSION }}
55+
generate_release_notes: true
56+
draft: false
57+
prerelease: false
4558
env:
46-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47-
run: npm run release
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)