Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
release:
types: [published]

permissions:
id-token: write # Required for npm OIDC trusted publishers
contents: read

jobs:
publish:
name: publish
Expand All @@ -17,9 +21,10 @@ jobs:
- uses: actions/checkout@v6

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: |
Expand All @@ -28,5 +33,3 @@ jobs:
- name: Publish to NPM
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.KERNEL_NPM_TOKEN || secrets.NPM_TOKEN }}
2 changes: 0 additions & 2 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ jobs:
- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.KERNEL_NPM_TOKEN || secrets.NPM_TOKEN }}

20 changes: 2 additions & 18 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
#!/usr/bin/env bash

errors=()

if [ -z "${NPM_TOKEN}" ]; then
errors+=("The NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi
# Publishing uses npm OIDC trusted publishers — no secrets required.
# The GitHub Actions workflow must have `permissions: id-token: write`.

echo "The environment is ready to push releases!"

6 changes: 2 additions & 4 deletions bin/publish-npm
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

set -eux

npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN"

yarn build
cd dist

Expand Down Expand Up @@ -57,5 +55,5 @@ else
TAG="latest"
fi

# Publish with the appropriate tag
yarn publish --tag "$TAG"
# Publish with the appropriate tag using npm OIDC trusted publishers
npm publish --provenance --access public --tag "$TAG"