diff --git a/.circleci/config.yml b/.circleci/config.yml index 1617db3e43..bb60152afb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -117,22 +117,10 @@ jobs: RELEASE_BRANCH=$(echo "$CIRCLE_TAG" | awk -F. '{print substr($1, 2) "." $2 ".x"}') echo "Release branch: $RELEASE_BRANCH" # Does a release branch contain this tag (hotfix workflow) (0 or 1) - echo "Here1" - echo "$CIRCLE_TAG $RELEASE_BRANCH" - git branch -a --contains "$CIRCLE_TAG" | grep -Fx " remotes/origin/$RELEASE_BRANCH" | wc -l - BRANCHES_CONTAINING_TAG=$(git branch -a --contains "$CIRCLE_TAG" 2>&1) || { echo "Error: $BRANCHES_CONTAINING_TAG"; exit 1; } - echo "Branches containing tag: $BRANCHES_CONTAINING_TAG" - - MATCHING_BRANCH=$(echo "$BRANCHES_CONTAINING_TAG" | grep -Fx " remotes/origin/$RELEASE_BRANCH") - echo "Matching branch: $MATCHING_BRANCH" - - LINE_COUNT=$(echo "$MATCHING_BRANCH" | wc -l) - echo "Line count: $LINE_COUNT" - TAG_ON_RELEASE_BRANCH=$(git branch -a --contains "$CIRCLE_TAG" | grep -Fx " remotes/origin/$RELEASE_BRANCH" | wc -l) - echo "Here2" + TAG_ON_RELEASE_BRANCH=$(git branch -a --contains "$CIRCLE_TAG" | grep -cFx " remotes/origin/$RELEASE_BRANCH" || true) echo "Tag is on release branch $RELEASE_BRANCH: $TAG_ON_RELEASE_BRANCH" # Does main contain this tag (0 or 1) - TAG_ON_MAIN=$(git branch -a --contains "$CIRCLE_TAG" | grep -Fx ' remotes/origin/main' | wc -l) + TAG_ON_MAIN=$(git branch -a --contains "$CIRCLE_TAG" | grep -cFx ' remotes/origin/main' || true) echo "Tag is on main branch: $TAG_ON_MAIN" if [ $TAG_ON_RELEASE_BRANCH -eq $TAG_ON_MAIN ]; then echo "Could not determine whether this tag is 'latest' or a hotfix. Aborting." @@ -141,7 +129,7 @@ jobs: TAG="latest" [ "$TAG_ON_RELEASE_BRANCH" -eq 1 ] && TAG=$RELEASE_BRANCH set -e - npm run publish --dist-tag=$TAG --dry-run + npm run publish --tag=$TAG --dry-run - run: rm ~/.npmrc workflows: