Skip to content

Commit e49270c

Browse files
tjenkinsonrobwalch
authored andcommitted
Use GitHub release env for npm publish (video-dev#7544)
* Use GitHub `release` env for npm publish As this is used for npm OIDC. Also stops passing the token given OIDC doesn't need it * Do not write token to config
1 parent c4d9bf3 commit e49270c

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ jobs:
279279
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280280

281281
release_npm:
282+
# npm oidc is configured for this environment
283+
# https://docs.npmjs.com/trusted-publishers#for-github-actions
284+
environment: release
282285
needs: [config, test_unit]
283286
if: needs.config.outputs.tag || needs.config.outputs.isMainBranch == 'true'
284287
runs-on: ubuntu-latest
@@ -323,7 +326,6 @@ jobs:
323326
./scripts/publish-npm.sh
324327
env:
325328
CI: true
326-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
327329
TAG: ${{ needs.config.outputs.tag }}
328330

329331
test_functional_required:

scripts/publish-npm.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
set -e
33

44
if [[ $(node ./scripts/check-already-published.js) = "not published" ]]; then
5-
# write the token to config
6-
# see https://docs.npmjs.com/private-modules/ci-server-config
7-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
85
if [[ -z "$TAG" ]]; then
96
npm publish --provenance --tag canary
107
echo "Published canary."

0 commit comments

Comments
 (0)