Skip to content

Commit 55c68b4

Browse files
committed
chore: release and publish from github actions (#850)
1 parent c232e71 commit 55c68b4

File tree

6 files changed

+300
-15
lines changed

6 files changed

+300
-15
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
- "8.0" # remove this after 8.0 is merged into main
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Install Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
cache: "pnpm"
24+
25+
- name: Install dependencies
26+
run: pnpm install
27+
28+
- name: Lint
29+
run: pnpm run lint
30+
31+
- name: Typecheck
32+
run: pnpm run typecheck && pnpm run dev:typecheck
33+
34+
- name: Build
35+
run: pnpm run build
36+
37+
- name: Publint
38+
run: pnpm run publint

.github/workflows/release.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v**"
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
environment: npm-publish
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v4
23+
24+
- name: Install Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: 22
28+
cache: pnpm
29+
30+
- name: Install dependencies
31+
run: pnpm install
32+
33+
- name: Extract release notes
34+
run: pnpm releaselog --format=notes ${{ github.ref_name }} > RELEASE_NOTES.md
35+
36+
- name: Create GitHub release
37+
uses: softprops/action-gh-release@v2
38+
with:
39+
body_path: RELEASE_NOTES.md
40+
prerelease: ${{ contains(github.ref_name, '-') }}
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Build
45+
run: pnpm run build
46+
47+
- name: Get dist tag
48+
id: tag
49+
run: echo "tag=$(pnpm exec jiti scripts/dist-tag.ts '${{ github.ref_name }}')" >> $GITHUB_OUTPUT
50+
51+
- name: Publish to npm
52+
run: npm i -g npm && pnpm publish --access public --tag ${{ steps.tag.outputs.tag }} --no-git-checks

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"author": "GU Yiling <[email protected]>",
1111
"scripts": {
1212
"dev": "vite",
13-
"build": "pnpm run docs && tsdown",
13+
"build": "tsdown",
1414
"typecheck": "tsc",
1515
"lint": "eslint . --fix",
1616
"format": "prettier . --write",
@@ -19,7 +19,7 @@
1919
"dev:preview": "vite preview",
2020
"dev:typecheck": "vue-tsc -p ./demo",
2121
"docs": "jiti ./scripts/docs.ts",
22-
"prepublishOnly": "pnpm run typecheck && pnpm run dev:typecheck && pnpm run build && publint"
22+
"release": "pnpm run docs && bumpp --all"
2323
},
2424
"packageManager": "[email protected]",
2525
"type": "module",
@@ -48,6 +48,7 @@
4848
"@vue/eslint-config-typescript": "^14.6.0",
4949
"@vue/tsconfig": "^0.7.0",
5050
"@vueuse/core": "^13.6.0",
51+
"bumpp": "^10.2.2",
5152
"comment-mark": "^2.0.1",
5253
"echarts": "^6.0.0",
5354
"echarts-gl": "^2.0.9",
@@ -61,6 +62,7 @@
6162
"postcss-nested": "^7.0.2",
6263
"prettier": "^3.6.2",
6364
"publint": "^0.3.12",
65+
"releaselog": "^6.0.3",
6466
"tsdown": "^0.13.3",
6567
"typescript": "^5.9.2",
6668
"unplugin-raw": "^0.5.1",

0 commit comments

Comments
 (0)