Skip to content

Commit 7d843fd

Browse files
committed
ci: publish to npmjs with npm token
1 parent b8e6189 commit 7d843fd

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ jobs:
2323
uses: actions/setup-node@v4
2424
with:
2525
node-version: 18
26-
registry-url: https://npm.pkg.github.com/
27-
scope: '@omarsdev'
26+
registry-url: https://registry.npmjs.org/
2827
cache: 'yarn'
2928

30-
- name: Write npmrc for GitHub Packages
29+
- name: Configure npm auth
3130
run: |
3231
cat <<'EOF' > .npmrc
33-
@omarsdev:registry=https://npm.pkg.github.com
34-
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
32+
//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}
3533
always-auth=true
3634
EOF
3735
env:
38-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_PACKAGES_TOKEN }}
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3937

4038
- name: Install dependencies
4139
run: yarn install --frozen-lockfile
@@ -55,7 +53,7 @@ jobs:
5553
- name: Publish to GitHub Packages
5654
run: npm publish
5755
env:
58-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_PACKAGES_TOKEN }}
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5957

6058
- name: Push version bump
6159
run: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ Merges to `develop` trigger the `Publish Package` GitHub Action, which:
5959
- publishes the build to GitHub Packages
6060
- pushes the updated version and tag back to `develop`
6161

62-
Before the workflow can publish, add a repository secret named `GITHUB_PACKAGES_TOKEN` that contains a GitHub personal access token with `write:packages` and `read:packages` scopes (include `delete:packages` if you expect to remove releases). The workflow injects this token into `npm publish` via the `NODE_AUTH_TOKEN` environment variable.
62+
Before the workflow can publish, add a repository secret named `NPM_TOKEN` that contains an npm automation token (publish scope). The workflow injects this token into `npm publish` via the `NODE_AUTH_TOKEN` environment variable.

0 commit comments

Comments
 (0)