Skip to content

Commit c8eeec3

Browse files
authored
fix: fix auto publish error (#158)
1 parent 068bece commit c8eeec3

File tree

3 files changed

+44
-15
lines changed

3 files changed

+44
-15
lines changed

.github/workflows/auto-publish.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
ref: ${{ github.ref_name }}
1818

1919
- name: Setup pnpm
20-
uses: pnpm/action-setup@v2
20+
uses: pnpm/action-setup@v4
21+
with:
22+
version: 9
2123

2224
- name: Setup Node
2325
uses: actions/setup-node@v3
@@ -40,23 +42,34 @@ jobs:
4042
- name: Install dependencies
4143
run: pnpm i --no-frozen-lockfile
4244
- name: Build
45+
run: pnpm build
46+
- name: Clean node_modules
4347
run: |
44-
pnpm build
48+
# 删除任何意外混进去的 node_modules
49+
ls
50+
rm -rf node_modules
51+
find template -type d -name node_modules -prune -exec rm -rf {} +
52+
# 生成待发布 tarball(验证用)
53+
npm pack --dry-run
4554
- name: Upload build artifact
4655
uses: actions/upload-artifact@v4
4756
with:
4857
name: dist-artifact
49-
path: dist/
58+
path: ./
5059
# Publish job
5160
publish:
5261
needs: build
5362
runs-on: ubuntu-latest
5463
steps:
64+
- uses: actions/setup-node@v4
65+
with:
66+
node-version: 20
67+
registry-url: https://registry.npmjs.org
5568
- name: Download build artifact
5669
uses: actions/download-artifact@v4
5770
with:
5871
name: dist-artifact
59-
path: dist/
72+
path: ./
6073
- name: Parse Publish tag
6174
id: parse_tag
6275
run: |
@@ -75,7 +88,7 @@ jobs:
7588
VERSION="$(node -p "require('./package.json').version")"
7689
echo "publish version: $VERSION"
7790
echo "publish tag: ${{ steps.parse_tag.outputs.dist_tag }}"
78-
- name: Publish @opentiny/fluent-editor
91+
- name: Publish @opentiny/tiny-toolkit-pro
7992
run: |
8093
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
8194
npm publish --tag ${{ steps.parse_tag.outputs.dist_tag }}

.github/workflows/dispatch-publish.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
# 步骤2: 设置pnpm包管理器
4141
- name: Setup pnpm
4242
uses: pnpm/action-setup@v4
43+
with:
44+
version: 9
4345

4446
# 步骤3: 设置Node.js环境
4547
- name: Setup Node
@@ -78,31 +80,46 @@ jobs:
7880
fi
7981
echo "version: $VERSION"
8082
echo "value=$VERSION" >> $GITHUB_OUTPUT
81-
82-
- name: Build lib
83+
- name: Bump version
84+
run: |
85+
# pnpm 自带 npm 版本管理
86+
pnpm version ${{ steps.ver.outputs.value }} --no-git-tag-version
87+
# 显示确认
88+
cat package.json | jq .version
89+
- name: Build
8390
run: pnpm build
91+
- name: Clean node_modules
92+
run: |
93+
# 删除任何意外混进去的 node_modules
94+
ls
95+
rm -rf node_modules
96+
find template -type d -name node_modules -prune -exec rm -rf {} +
97+
# 生成待发布 tarball(验证用)
98+
npm pack --dry-run
8499
- name: Upload build artifact
85100
uses: actions/upload-artifact@v4
86101
with:
87102
name: dist-artifact
88-
path: dist/
103+
path: ./
89104
# Publish job
90105
publish:
91106
needs: build
92107
runs-on: ubuntu-latest
93108
steps:
109+
- uses: actions/setup-node@v4
110+
with:
111+
node-version: 20
112+
registry-url: https://registry.npmjs.org
94113
- name: Download build artifact
95114
uses: actions/download-artifact@v4
96115
with:
97116
name: dist-artifact
98-
path: dist/
117+
path: ./
99118
- name: Show version and tag
100119
run: |
101120
echo "publish version: ${{ needs.build.outputs.version }}"
102121
echo "publish tag: ${{ inputs.tag }}"
103-
104-
# 步骤8: 发布组件到NPM
105-
- name: Publish @opentiny/fluent-editor
122+
- name: Publish @opentiny/tiny-toolkit-pro
106123
run: |
107124
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
108125
npm publish --tag ${{ inputs.tag }}

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opentiny/tiny-toolkit-pro",
3-
"version": "1.4.0-alpha.2",
3+
"version": "1.4.0-beta.0",
44
"description": "TinyPro Vue:开箱即用、前后端分离的 Vue 后台管理模板",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",
@@ -55,8 +55,7 @@
5555
"doc:html": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --out build/docs",
5656
"doc:json": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --json build/docs/typedoc.json",
5757
"doc:publish": "gh-pages -m \"[ci skip] Updates\" -d build/docs",
58-
"clean": "trash build test",
59-
"prepublishOnly": "run-s fix build"
58+
"clean": "trash build test"
6059
},
6160
"scripts-info": {
6261
"info": "Display information about the package scripts",

0 commit comments

Comments
 (0)