Skip to content

Commit 3d83dad

Browse files
authored
New attempt at fixing NPM publishing with trusted publisher (#3810)
1 parent 8dc5c18 commit 3d83dad

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

.github/workflows/publish.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ on:
55
branches:
66
- main
77

8-
permissions:
9-
id-token: write
10-
pull-requests: write
11-
contents: write
12-
138
env:
149
BUN_NPM_TOKEN: ${{ secrets.NPM_TOKEN_READONLY }}
1510

@@ -19,6 +14,10 @@ jobs:
1914
publish:
2015
name: Publish
2116
runs-on: ubuntu-latest
17+
permissions:
18+
id-token: write
19+
pull-requests: write
20+
contents: write
2221
steps:
2322
- name: Checkout Repo
2423
uses: actions/checkout@v3
@@ -50,7 +49,3 @@ jobs:
5049
- name: Publish to NPM
5150
if: steps.changesets.outputs.hasChangesets == 'false'
5251
run: bun run publish-all-packages
53-
env:
54-
GITHUB_TOKEN: ${{ github.token }}
55-
NODE_AUTH_TOKEN: ${{ env.NODE_AUTH_TOKEN }}
56-
NPM_CONFIG_USERCONFIG: ${{ env.NPM_CONFIG_USERCONFIG }}

scripts/publish-if-new.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
set -euo pipefail
1010

11+
echo "Node auth token: ${NODE_AUTH_TOKEN}"
12+
echo "NPM config userconfig: ${NPM_CONFIG_USERCONFIG}"
13+
1114
NAME=$(node -p "require('./package.json').name")
1215
VERSION=$(node -p "require('./package.json').version")
1316

@@ -37,4 +40,5 @@ fi
3740
# Clean up the tarball
3841
trap 'rm -f "${TARBALL_PATH}"' EXIT
3942

40-
npm publish "${TARBALL_PATH}" --no-workspaces --provenance
43+
# Publish with verbose logging to aid debugging
44+
npm publish "${TARBALL_PATH}" --no-workspaces --provenance --loglevel=verbose

turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"publish-to-npm": {
5858
"dependsOn": ["build"],
5959
"cache": false,
60-
"env": ["NODE_AUTH_TOKEN", "NPM_CONFIG_USERCONFIG"]
60+
"env": ["NODE_AUTH_TOKEN", "NPM_CONFIG_USERCONFIG", "ACTIONS_ID_TOKEN_*"]
6161
},
6262
// Clean up the package
6363
"clean": {

0 commit comments

Comments
 (0)