Skip to content

Commit ea2fa81

Browse files
committed
ci: 添加npm自动发布流程
1 parent 7fdd7eb commit ea2fa81

File tree

2 files changed

+35
-91
lines changed

2 files changed

+35
-91
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 0 additions & 86 deletions
This file was deleted.

.github/workflows/release-please.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,39 @@ jobs:
1212
release-please:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: google-github-actions/release-please-action@v3
15+
- uses: googleapis/release-please-action@v4
16+
id: release
1617
with:
17-
token: ${{ secrets.GITHUB_TOKEN }}
18-
release-type: 'node' # 针对 Node.js 项目
19-
package-name: 'prettier-plugin-lint-md' # 与 package.json 名称一致
20-
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false}]'
18+
release-type: node
19+
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
if: ${{ steps.release.outputs.release_created }}
25+
26+
- uses: pnpm/action-setup@v3
27+
with:
28+
version: 10
29+
if: ${{ steps.release.outputs.release_created }}
30+
31+
- name: Setup Node
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 22
35+
cache: pnpm
36+
registry-url: 'https://registry.npmjs.org'
37+
if: ${{ steps.release.outputs.release_created }}
38+
39+
- name: Install dependencies
40+
run: pnpm install
41+
if: ${{ steps.release.outputs.release_created }}
42+
43+
- name: Build project
44+
run: pnpm run build
45+
if: ${{ steps.release.outputs.release_created }}
46+
47+
- run: npm publish
48+
env:
49+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
50+
if: ${{ steps.release.outputs.release_created }}

0 commit comments

Comments
 (0)