Skip to content

Commit c59b166

Browse files
committed
Harden npm publish: write project .npmrc with token
1 parent be9eb68 commit c59b166

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ jobs:
7171
- uses: actions/setup-node@v4
7272
with:
7373
node-version: "20"
74-
registry-url: "https://registry.npmjs.org"
75-
always-auth: true
76-
token: ${{ secrets.NPM_TOKEN }}
7774

7875
- name: Verify npm version matches tag
7976
run: |
@@ -86,6 +83,9 @@ jobs:
8683
env:
8784
TAG: ${{ steps.tag.outputs.value }}
8885

86+
- name: Configure npm auth
87+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > npm/.npmrc
88+
8989
- name: Publish commitor-cli
9090
run: npm publish --access public
9191
working-directory: npm

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target
2+
npm/.npmrc

0 commit comments

Comments
 (0)