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
20 changes: 18 additions & 2 deletions build-system/scripts/deploy_npm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down