Skip to content

Commit

Permalink
chore: enable project-specific tagged releases (#1425)
Browse files Browse the repository at this point in the history
This change should allow us to create tags for releasing a specific
package from `yarn-project`
e.g. Tagging `master` with `aztec.js/v0.1.1` will create a v0.1.1
release **only** for aztec.js. Tagging with `v0.1.1` will release
everything on that version (we still check if current version is below
that to avoid mis-versioning)
  • Loading branch information
spypsy authored Aug 11, 2023
1 parent 7e14e7b commit 28cbe7b
Showing 1 changed file with 18 additions and 2 deletions.
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

0 comments on commit 28cbe7b

Please sign in to comment.