From a5cbf8f7303d4d5fa6285c3eaa1867b090e09236 Mon Sep 17 00:00:00 2001 From: spypsy Date: Tue, 22 Aug 2023 08:37:27 +0000 Subject: [PATCH] enable project-specific releases for dockerhub too --- build-system/scripts/deploy_dockerhub | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/build-system/scripts/deploy_dockerhub b/build-system/scripts/deploy_dockerhub index 1808783e111..1f1db34287f 100755 --- a/build-system/scripts/deploy_dockerhub +++ b/build-system/scripts/deploy_dockerhub @@ -7,11 +7,36 @@ if [ -z "$COMMIT_TAG" ]; then fi REPOSITORY=$1 -IMAGE_TAG=$COMMIT_TAG IMAGE_COMMIT_URI=$ECR_DEPLOY_URL/$REPOSITORY:$COMMIT_HASH IMAGE_DEPLOY_URI=aztecprotocol/$REPOSITORY:$IMAGE_TAG IMAGE_LATEST_URI=aztecprotocol/$REPOSITORY:latest +# 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 + +# Check it's a valid semver. +VERSION=$(npx semver $COMMIT_TAG_VERSION) +if [ -z "$VERSION" ]; then + echo "$COMMIT_TAG_VERSION is not a semantic version." + exit 1 +fi + +IMAGE_TAG=$COMMIT_TAG_VERSION + + echo "Deploying to dockerhub: $IMAGE_DEPLOY_URI" # Login.