Skip to content

Commit 7c95361

Browse files
committed
chore: add publish actions
1 parent 5d2b165 commit 7c95361

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

.github/workflows/publish beta npm.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,29 @@ jobs:
2424
with:
2525
node-version: '16' # 或者您希望的任何版本
2626

27-
- name: Install Dependencies and Publish
27+
- name: Configure Git
2828
run: |
2929
git config --local user.email "action@github.com"
3030
git config --local user.name "GitHub Action"
31-
npm install
32-
cd packages
33-
cd ${{ github.event.inputs.packagePath }}
34-
npm install
35-
# 假设您使用 npm 来修改版本和发布
36-
npm run build
37-
npm version ${{ github.event.inputs.betaVersion }}
38-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
3931
32+
- name: Install Root Dependencies
33+
run: npm install
34+
35+
- name: Change to Package Directory
36+
run: cd packages/${{ github.event.inputs.packagePath }}
37+
38+
- name: Install Package Dependencies
39+
run: npm install
40+
41+
- name: Build Package
42+
run: npm run build
43+
44+
- name: Update Package Version
45+
run: npm version ${{ github.event.inputs.betaVersion }}
46+
47+
- name: Publish Package
48+
run: |
49+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
4050
npm publish
4151
env:
4252
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 确保在您的 GitHub 仓库的 Secrets 中设置了 NPM_TOKEN

.github/workflows/publish npm.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,25 @@ jobs:
2626
with:
2727
node-version: '16' # 或者您希望的任何版本
2828

29-
- name: Install Dependencies and Publish
29+
- name: Configure Git
3030
run: |
3131
git config --local user.email "action@github.com"
3232
git config --local user.name "GitHub Action"
33-
npm install
34-
cd packages
35-
cd ${{ github.event.inputs.packagePath }}
36-
npm install
37-
# 假设您使用 npm 来修改版本和发布
38-
npm run build
33+
34+
- name: Install Root Dependencies
35+
run: npm install
36+
37+
- name: Change to Package Directory
38+
run: cd packages/${{ github.event.inputs.packagePath }}
39+
40+
- name: Install Package Dependencies
41+
run: npm install
42+
43+
- name: Build Package
44+
run: npm run build
45+
46+
- name: Publish Package
47+
run: |
3948
npm version patch
4049
4150
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

0 commit comments

Comments
 (0)