Skip to content

Commit 657fef2

Browse files
authored
ci: fix error when publish to npm in github action (#10)
1 parent 6ab5f7f commit 657fef2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/build-deploy.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ jobs:
4444
- name: Checkout Repository 🛎️
4545
uses: actions/checkout@v4
4646

47+
- name: Setup Node.js ⚙️
48+
uses: actions/setup-node@v4
49+
with:
50+
node-version: '20'
51+
registry-url: 'https://registry.npmjs.org/'
52+
4753
- name: Install Dependencies 📦
4854
run: npm install
4955

@@ -64,11 +70,6 @@ jobs:
6470
env:
6571
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
6672

67-
- name: Publish to npm 📦
68-
run: npm publish
69-
env:
70-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
71-
7273
- name: Create GitHub Release 📦
7374
uses: softprops/action-gh-release@v1
7475
with:
@@ -79,3 +80,11 @@ jobs:
7980
prerelease: false
8081
env:
8182
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
83+
84+
- name: Configure npm
85+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
86+
87+
- name: Publish to npm 📦
88+
run: npm publish
89+
env:
90+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)