Skip to content

Commit db9f656

Browse files
Kaycellclaude
andauthored
AAWF-694: Migrate NPM publishing to OIDC trusted publishing (#3949)
Switch from classic NPM token auth to OIDC trusted publishing: - Add id-token: write permission for OIDC - Upgrade to actions/setup-node@v4 with Node 24 and registry-url - Replace yarn publish with npm publish --provenance - Remove YARN_NPM_AUTH_TOKEN secret dependency Trusted Publisher has been configured on npmjs.com for all 117 @datadog/datadog-api-client* packages. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5292de4 commit db9f656

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

.github/workflows/publish.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Publish package on NPM
22

33
permissions:
44
contents: write
5+
id-token: write # Required for OIDC trusted publishing
56

67
on:
78
release:
@@ -15,9 +16,10 @@ jobs:
1516
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1617
with:
1718
fetch-depth: 1
18-
- uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v4
1920
with:
20-
node-version: 18
21+
node-version: 24
22+
registry-url: 'https://registry.npmjs.org'
2123
- name: Releasing tag ${{ github.event.release.tag_name }}
2224
run: |
2325
corepack enable; yarn
@@ -29,24 +31,10 @@ jobs:
2931
cd $(echo $tag_name | rev | cut -d'/' -f2- | rev)
3032
fi
3133
32-
yarn_major_version=$(yarn --version | cut -d'.' -f1)
33-
if [ "$yarn_major_version" -ge 2 ] && [ "$yarn_major_version" -le 4 ]; then
34-
cmd="yarn npm publish --access public"
35-
elif [ "$yarn_major_version" -eq 1 ]; then
36-
cmd="yarn publish --access public"
37-
else
38-
echo "Unsupported Yarn version: $yarn_major_version"
39-
exit 1
40-
fi
41-
4234
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
43-
cmd+=" --tag=beta"
35+
npm publish --provenance --access public --tag beta
4436
else
45-
cmd+=" --tag=latest"
37+
npm publish --provenance --access public --tag latest
4638
fi
47-
48-
eval $cmd
4939
env:
50-
NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
51-
YARN_NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
5240
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0

0 commit comments

Comments
 (0)