NPM: Publish all packages in Github Actions (#111034)

* Initial npm-publish workflow

* Validate version type and version match, typecheck packages before building, set npm tag

* quote GITHUB_OUTPUT

* codeowners

* fix syntax in release-build

* only tag the latest version with latest

* don't require NPM_TOKEN env var to be set if using OIDC

* put comment back

* tighten script

* Codeowners

* Use workflow_call for canaries, Rename workflow to match release-build

* codeowners
This commit is contained in:
Josh Hunt
2025-09-18 17:24:59 +00:00
committed by GitHub
parent cb11bc15fa
commit d96d7e680c
6 changed files with 233 additions and 37 deletions
+7 -4
View File
@@ -5,9 +5,11 @@
dist_tag="canary"
registry="http://localhost:4873"
if [ -z "$NPM_TOKEN" ]; then
echo "The NPM_TOKEN environment variable does not exist."
exit 1
# Require either ACTIONS_ID_TOKEN_REQUEST_URL or NPM_TOKEN to be set
if [ -z "$ACTIONS_ID_TOKEN_REQUEST_URL" ] && [ -z "$NPM_TOKEN" ]; then
echo "ERROR: Either ACTIONS_ID_TOKEN_REQUEST_URL or NPM_TOKEN environment variable must be set."
echo "If running in Github Actions, ensure that 'id-token: write' permission is granted."
exit 1
fi
# Parse command line arguments
@@ -33,7 +35,8 @@ done
echo "Starting to release $dist_tag version with NPM version $(npm --version) to registry $registry"
if [[ "$NPM_TOKEN" != "oidc" ]]; then
if [ -n "$NPM_TOKEN" ]; then
echo "Configured NPM_TOKEN in ~/.npmrc"
registry_without_protocol=${registry#*:}
echo "$registry_without_protocol/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
fi