Skip to content

Commit 84e9356

Browse files
committed
chore: 更新依赖版本,添加新依赖并修改 README 文档,调整 GitHub Actions 工作流配置
1 parent 73e126a commit 84e9356

File tree

5 files changed

+253
-414
lines changed

5 files changed

+253
-414
lines changed

.github/workflows/release.yml

Lines changed: 109 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,128 @@
1-
# This action will publish the package to npm and create a GitHub release.
21
name: Release
32

43
on:
5-
# Run `npm run bump` to bump the version and create a git tag.
64
push:
75
tags:
8-
- "v*"
9-
6+
- 'v*'
107
workflow_dispatch:
11-
12-
permissions:
13-
contents: write
14-
id-token: write
8+
inputs:
9+
version:
10+
description: '发布版本 (例如: 1.0.0)'
11+
required: true
12+
type: string
1513

1614
jobs:
17-
publish:
15+
release:
1816
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
packages: write
20+
id-token: write
21+
1922
steps:
20-
- name: Checkout
23+
- name: 检出代码
2124
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
2227

23-
- name: Install Pnpm
24-
run: corepack enable
25-
26-
- name: Setup Node.js
28+
- name: 设置 Node.js
2729
uses: actions/setup-node@v4
2830
with:
29-
node-version: 22
30-
cache: "pnpm"
31+
node-version: '18'
32+
registry-url: 'https://registry.npmjs.org'
33+
34+
- name: 安装 pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: 10
3138

32-
- name: Install Dependencies
33-
run: pnpm install
39+
- name: 获取 pnpm store 目录
40+
shell: bash
41+
run: |
42+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
3443
35-
- name: Publish
36-
uses: JS-DevTools/npm-publish@v3
44+
- name: 设置 pnpm 缓存
45+
uses: actions/cache@v4
3746
with:
38-
token: ${{ secrets.NPM_TOKEN }}
47+
path: ${{ env.STORE_PATH }}
48+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
49+
restore-keys: |
50+
${{ runner.os }}-pnpm-store-
51+
52+
- name: 安装依赖
53+
run: |
54+
# 尝试使用 frozen lockfile,如果失败则更新 lockfile
55+
pnpm install --frozen-lockfile || {
56+
echo "⚠️ Lockfile 不匹配,正在更新..."
57+
pnpm install --no-frozen-lockfile
58+
}
3959
40-
- name: Create GitHub Release
41-
uses: ncipollo/release-action@v1
60+
- name: 格式检查
61+
run: pnpm run lint
62+
63+
- name: 构建项目
64+
run: pnpm run build
65+
66+
- name: 获取版本号
67+
id: get_version
68+
run: |
69+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
70+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
71+
echo "tag_name=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
72+
else
73+
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
74+
echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
75+
fi
76+
77+
- name: 更新版本号 (手动触发时)
78+
if: github.event_name == 'workflow_dispatch'
79+
run: |
80+
npm version ${{ steps.get_version.outputs.version }} --no-git-tag-version
81+
git config --local user.email "[email protected]"
82+
git config --local user.name "GitHub Action"
83+
git add package.json
84+
git commit -m "chore: bump version to ${{ steps.get_version.outputs.version }}"
85+
git tag ${{ steps.get_version.outputs.tag_name }}
86+
git push origin HEAD:${{ github.ref_name }}
87+
git push origin ${{ steps.get_version.outputs.tag_name }}
88+
89+
- name: 生成变更日志
90+
id: changelog
91+
run: |
92+
# 获取上一个标签
93+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
94+
95+
if [ -z "$PREV_TAG" ]; then
96+
# 如果没有上一个标签,获取所有提交
97+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
98+
else
99+
# 获取两个标签之间的提交
100+
CHANGELOG=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges)
101+
fi
102+
103+
# 保存到文件以避免特殊字符问题
104+
echo "$CHANGELOG" > changelog.txt
105+
echo "changelog_file=changelog.txt" >> $GITHUB_OUTPUT
106+
107+
- name: 发布到 npm
108+
run: pnpm publish --no-git-checks
109+
env:
110+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
111+
112+
- name: 创建 GitHub Release
113+
uses: actions/create-release@v1
114+
env:
115+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42116
with:
43-
generateReleaseNotes: "true"
117+
tag_name: ${{ steps.get_version.outputs.tag_name }}
118+
release_name: Release ${{ steps.get_version.outputs.tag_name }}
119+
body_path: ${{ steps.changelog.outputs.changelog_file }}
120+
draft: false
121+
prerelease: false
122+
123+
- name: 通知发布成功
124+
run: |
125+
echo "🎉 发布成功!"
126+
echo "📦 版本: ${{ steps.get_version.outputs.version }}"
127+
echo "🏷️ 标签: ${{ steps.get_version.outputs.tag_name }}"
128+
echo "📝 npm: https://www.npmjs.com/package/@winner-fed/plugin-unicons"

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
# @winner-fed/plugin-unicons
1+
# winjs-plugin-unicons
22

3-
🎨 基于 [unplugin-icons](https://github.com/unplugin/unplugin-icons) 的图标解决方案,提供强大的图标管理和使用体验。
3+
一个为 WinJS 项目提供的图标解决方案,底层基于 [unplugin-icons](https://github.com/unplugin/unplugin-icons) 插件,提供强大的图标管理和使用体验。
4+
5+
<p>
6+
<a href="https://npmjs.com/package/@winner-fed/plugin-icons">
7+
<img src="https://img.shields.io/npm/v/@winner-fed/plugin-icons?style=flat-square&colorA=564341&colorB=EDED91" alt="npm version" />
8+
</a>
9+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
10+
<a href="https://npmcharts.com/compare/@winner-fed/plugin-icons?minimal=true"><img src="https://img.shields.io/npm/dm/@winner-fed/plugin-icons.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="downloads" /></a>
11+
</p>
412

513
## ✨ 特性
614

package.json

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@
3232
"svgo": "^3.3.2"
3333
},
3434
"devDependencies": {
35-
"@biomejs/biome": "^1.9.4",
36-
"@playwright/test": "^1.50.1",
35+
"@biomejs/biome": "^2.1.1",
36+
"@playwright/test": "^1.53.2",
37+
"@rsbuild/core": "^1.4.2",
38+
"@rslib/core": "^0.10.4",
39+
"@types/node": "^22.15.34",
3740
"@winner-fed/winjs": "^0.16.4",
3841
"@winner-fed/utils": "^0.16.4",
39-
"@rslib/core": "^0.5.0",
40-
"@types/node": "^22.13.4",
41-
"playwright": "^1.50.1",
42-
"simple-git-hooks": "^2.11.1",
43-
"typescript": "^5.7.3"
42+
"playwright": "^1.53.2",
43+
"simple-git-hooks": "^2.13.0",
44+
"typescript": "^5.8.3"
4445
},
4546
"peerDependencies": {
4647
"@rsbuild/core": "1.x",
@@ -55,7 +56,34 @@
5556
"optional": true
5657
}
5758
},
58-
"packageManager": "[email protected]",
59+
"keywords": [
60+
"winjs",
61+
"plugin",
62+
"icons",
63+
"unicons",
64+
"svg",
65+
"vue",
66+
"vue2",
67+
"vue3",
68+
"vite",
69+
"webpack",
70+
"rspack",
71+
"rsbuild",
72+
"rslib",
73+
"unplugin-icons",
74+
"iconify",
75+
"icon-library",
76+
"icon-components",
77+
"auto-import",
78+
"tree-shaking",
79+
"svg-optimization",
80+
"local-icons",
81+
"custom-icons",
82+
"ui-components",
83+
"frontend",
84+
"build-tools",
85+
"bundler-plugin"
86+
],
5987
"publishConfig": {
6088
"access": "public",
6189
"registry": "https://registry.npmjs.org/"

playground/.winrc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cpSync('./@test-scope', './node_modules/@test-scope', { recursive: true });
1616
export default defineConfig({
1717
npmClient: 'yarn',
1818
mountElementId: 'winjsTemplateDemo2c78llfeubf',
19-
plugins: ['../src/index.ts'],
19+
plugins: ['../src'],
2020
unIcons: {
2121
customCollections: {
2222
...ExternalPackageIconLoader('@test-scope/test-color-icons'),

0 commit comments

Comments
 (0)