Skip to content
Merged
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
28 changes: 24 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,29 @@ jobs:
- name: Build npm packages
run: bun run build:npm

# Trusted publishing (OIDC) needs npm >= 11.5.1; setup-node's bundled npm may be older.
- name: Upgrade npm for trusted publishing
run: npm install -g npm@latest

# No NODE_AUTH_TOKEN: npm detects the GitHub Actions OIDC environment (id-token: write)
# and authenticates via the per-package Trusted Publisher configured on npmjs.com.
# Provenance is generated automatically for trusted publishing.
# Idempotent: skip versions already on npm so a re-run (e.g. after a
# partial publish) only pushes the packages still missing, instead of
# aborting on the first "cannot publish over previous version".
- name: Publish to npm
run: |
for dir in npm/code-*; do
(cd "$dir" && npm publish --provenance --access public)
done
cd npm/code && npm publish --provenance --access public
set -euo pipefail
publish_if_new() {
local dir="$1" name ver
name=$(cd "$dir" && node -p "require('./package.json').name")
ver=$(cd "$dir" && node -p "require('./package.json').version")
if npm view "$name@$ver" version >/dev/null 2>&1; then
echo "== skip $name@$ver (already published)"
else
echo "== publish $name@$ver"
(cd "$dir" && npm publish --access public)
fi
}
for dir in npm/code-*; do publish_if_new "$dir"; done
publish_if_new npm/code
Loading