Skip to content

Commit a3cd6f3

Browse files
Update npm-publish.yml
1 parent 236eb78 commit a3cd6f3

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

.github/workflows/npm-publish.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,28 @@
44
name: Node.js Package
55

66
on:
7-
workflow_dispatch:
8-
release:
9-
types: [created]
7+
push:
8+
branches:
9+
- main
1010

1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
17-
with:
18-
node-version: 20
19-
- run: npm ci
20-
- run: npm publish
15+
- name: Checkout code
16+
uses: actions/checkout@v2
2117

22-
publish-npm:
23-
needs: build
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-node@v4
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v2
2820
with:
29-
node-version: 20
30-
registry-url: https://registry.npmjs.org/
31-
- run: npm ci
32-
- run: npm publish
33-
env:
34-
NODE_AUTH_TOKEN: ${{secrets.NPMTOKEN}}
21+
node-version: '19'
22+
registry-url: 'https://registry.npmjs.org/'
23+
24+
- name: Authenticate to npm
25+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMTOKEN }}" > ~/.npmrc
26+
27+
- name: Install dependencies
28+
run: npm install
29+
30+
- name: Publish package
31+
run: npm publish

0 commit comments

Comments
 (0)