Skip to content

Commit

Permalink
Update config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
robhogan authored Sep 20, 2023
1 parent 7fc5e97 commit 34c4694
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -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:
Expand Down

0 comments on commit 34c4694

Please sign in to comment.