Skip to content

Commit 5f2dac3

Browse files
committed
ci: migrate release publish to github actions
1 parent 558a8e7 commit 5f2dac3

File tree

6 files changed

+62
-32
lines changed

6 files changed

+62
-32
lines changed

.github/workflows/lint.yml renamed to .github/workflows/lint.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v6
1414

1515
- name: Install pnpm
1616
uses: pnpm/action-setup@v4
1717

1818
- name: Set Node.js
19-
uses: actions/setup-node@v4
19+
uses: actions/setup-node@v6
2020
with:
21-
node-version: 20.x
21+
node-version: 24
2222

2323
- name: Install
2424
run: pnpm i

.github/workflows/release-tag.yml

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

.github/workflows/release.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
test:
10+
uses: ./.github/workflows/test.yaml
11+
12+
release:
13+
if: github.repository == 'pengzhanbo/vite-plugin-mock-dev-server'
14+
needs: [test]
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
id-token: write
19+
steps:
20+
- uses: actions/checkout@v6
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v4
26+
27+
- uses: actions/setup-node@v6
28+
with:
29+
node-version: 24
30+
registry-url: https://registry.npmjs.org
31+
cache: pnpm
32+
33+
- name: Install deps
34+
run: pnpm install
35+
36+
- name: Update npm
37+
run: npm i -g npm@latest
38+
39+
- name: Build And Publish
40+
id: publish
41+
run: |
42+
pnpm build
43+
pnpm release:publish --no-git-checks
44+
45+
- run: npx changelogithub
46+
env:
47+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/test.yml renamed to .github/workflows/test.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@ on:
44
branches: [main]
55
pull_request:
66
branches: [main]
7+
workflow_call:
78

89
jobs:
910
test:
1011
runs-on: ubuntu-latest
1112

1213
steps:
13-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v6
1415

1516
- name: Install pnpm
1617
uses: pnpm/action-setup@v4
1718

1819
- name: Set Node.js
19-
uses: actions/setup-node@v4
20+
uses: actions/setup-node@v6
2021
with:
21-
node-version: 20.x
22+
node-version: 24
2223

2324
- name: Install
2425
run: pnpm i

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"packageManager": "[email protected]",
77
"author": "pengzhanbo <[email protected]> (https://github.com/pengzhanbo)",
88
"license": "MIT",
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/pengzhanbo/vite-plugin-mock-dev-server"
12+
},
913
"scripts": {
1014
"build": "pnpm -F vite-plugin-mock-dev-server build",
1115
"dev": "pnpm -F example dev",
@@ -16,8 +20,8 @@
1620
"lint": "eslint .",
1721
"test": "vitest",
1822
"release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
19-
"release:version": "bumpp package.json {vite-plugin-mock-dev-server,docs,example}/package.json --execute=\"pnpm release:changelog\" --commit --all --push --tag",
20-
"release": "pnpm release:version && vitest run && pnpm run build && pnpm -r publish"
23+
"release:publish": "pnpm -r publish",
24+
"release": "bumpp package.json {vite-plugin-mock-dev-server,docs,example}/package.json --execute=\"pnpm release:changelog\" --commit --all --push --tag"
2125
},
2226
"devDependencies": {
2327
"@pengzhanbo/eslint-config": "catalog:dev",

vite-plugin-mock-dev-server/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"vite": "catalog:dev"
8787
},
8888
"publishConfig": {
89-
"access": "public"
89+
"access": "public",
90+
"provenance": true
9091
}
9192
}

0 commit comments

Comments
 (0)