Skip to content

Commit 9c0be21

Browse files
danbot315Daniel Clayton
andauthored
ci: switch release and snapshot publish paths to npmjs with NPM_AUTH_TOKEN (#17)
Co-authored-by: Daniel Clayton <dan@Daniels-Mac-mini.local>
1 parent 6b4e68c commit 9c0be21

5 files changed

Lines changed: 18 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
runs-on: ubuntu-latest
5151
permissions:
5252
contents: read
53-
packages: write
5453

5554
steps:
5655
- name: Checkout PR head
@@ -81,20 +80,20 @@ jobs:
8180
- name: Version snapshot from changesets
8281
if: steps.changesets.outputs.count != '0'
8382
env:
84-
GITHUB_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8584
run: bunx changeset version --snapshot pr-${{ github.event.pull_request.number }}
8685

87-
- name: Configure npm auth for GitHub Packages
86+
- name: Configure npm auth for npmjs
8887
if: steps.changesets.outputs.count != '0'
8988
env:
90-
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
89+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
9190
run: |
92-
echo "@dotgithub:registry=https://npm.pkg.github.com" >> ~/.npmrc
93-
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
91+
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
92+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
9493
9594
- name: Publish snapshot tag
9695
if: steps.changesets.outputs.count != '0'
9796
env:
98-
GITHUB_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
99-
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
100-
run: bunx changeset publish --tag pr-${{ github.event.pull_request.number }} --registry https://npm.pkg.github.com
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
99+
run: bunx changeset publish --tag pr-${{ github.event.pull_request.number }} --registry https://registry.npmjs.org

.github/workflows/release.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ concurrency:
1010

1111
permissions:
1212
contents: write
13-
packages: write
1413

1514
jobs:
1615
release:
@@ -44,7 +43,7 @@ jobs:
4443
- name: Version packages from changesets
4544
if: steps.changesets.outputs.count != '0'
4645
env:
47-
GITHUB_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4847
run: bun run changeset:version
4948

5049
- name: Commit version updates to main
@@ -56,17 +55,17 @@ jobs:
5655
git commit -m "chore(release): version packages [skip ci]" || exit 0
5756
git push
5857
59-
- name: Configure npm auth for GitHub Packages
58+
- name: Configure npm auth for npmjs
6059
if: steps.changesets.outputs.count != '0'
6160
env:
62-
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
61+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
6362
run: |
64-
echo "@dotgithub:registry=https://npm.pkg.github.com" >> ~/.npmrc
65-
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
63+
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
64+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> ~/.npmrc
6665
6766
- name: Publish packages
6867
if: steps.changesets.outputs.count != '0'
6968
env:
70-
GITHUB_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
71-
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN || secrets.GITHUB_TOKEN }}
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
7271
run: bun run changeset:publish

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"test:packages": "bun run --filter './packages/*' test",
2020
"changeset": "changeset",
2121
"changeset:version": "changeset version",
22-
"changeset:publish": "changeset publish --registry https://npm.pkg.github.com",
22+
"changeset:publish": "changeset publish --registry https://registry.npmjs.org",
2323
"changeset:status": "changeset status --verbose"
2424
},
2525
"devDependencies": {

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"bun": ">=1.2.22"
2121
},
2222
"publishConfig": {
23-
"registry": "https://npm.pkg.github.com",
23+
"registry": "https://registry.npmjs.org",
2424
"access": "public"
2525
}
2626
}

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"bun": ">=1.2.22"
2525
},
2626
"publishConfig": {
27-
"registry": "https://npm.pkg.github.com",
27+
"registry": "https://registry.npmjs.org",
2828
"access": "public"
2929
},
3030
"devoptimizer": {

0 commit comments

Comments
 (0)