diff --git a/build-system/scripts/deploy_npm b/build-system/scripts/deploy_npm index 483283a76bd..71185633370 100755 --- a/build-system/scripts/deploy_npm +++ b/build-system/scripts/deploy_npm @@ -13,10 +13,26 @@ cd project/src/$(query_manifest projectDir $REPOSITORY) echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc +# Check if it's a repo-specific tag +if [[ "$COMMIT_TAG" == *"/"* ]]; then + REPO_NAME="${COMMIT_TAG%%/*}" + COMMIT_TAG_VERSION="${COMMIT_TAG#*/}" + echo "Tag was made for: $REPO_NAME" + echo "Version: $COMMIT_TAG_VERSION" + + # Check if REPO_NAME is equal to REPOSITORY + if [ "$REPO_NAME" != "$REPOSITORY" ]; then + echo "REPO_NAME ($REPO_NAME) does not match REPOSITORY ($REPOSITORY). Exiting..." + exit 1 + fi +else + COMMIT_TAG_VERSION=$COMMIT_TAG +fi + # We are publishing a tagged commit. Check it's a valid semver. -VERSION=$(npx semver $COMMIT_TAG) +VERSION=$(npx semver $COMMIT_TAG_VERSION) if [ -z "$VERSION" ]; then - echo "$COMMIT_TAG is not a semantic version." + echo "$COMMIT_TAG_VERSION is not a semantic version." exit 1 fi