From 56842794032bfea2cabe0a38fe725b9979724fe9 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 11:47:46 +0000 Subject: [PATCH 1/4] CircleCI: don't recreate tags that already exist --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f3092ba1..907aa8b0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,7 +103,7 @@ jobs: name: Create tags (master branch only) command: > if [ "${CIRCLE_BRANCH}" == "master" ]; then - git tag -f -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push -f --tags; + git tag -a $(sh contrib/semver/version.sh) -m "Created by CircleCI" && git push --tags; else echo "Only runs for master branch (this is ${CIRCLE_BRANCH})"; fi; From bfdb079b791a532af3a3a7ce3d6d742fca89d7c7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 11:52:22 +0000 Subject: [PATCH 2/4] Append suffix to master releaser releases if they are not the first merge (package revisions) --- contrib/semver/version.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index a53ed32c..a17cf6fe 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -59,4 +59,8 @@ if [ $BRANCH != "master" ]; then if [ $BUILD != 0 ]; then printf -- "-%04d" "$BUILD" fi +else + if [ $BUILD != 0 ]; then + printf -- "-%d" "$BUILD" + fi fi From 3ea33c9fa72ae0dcdf04e6d0fc2872aae28cdc68 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 12:03:23 +0000 Subject: [PATCH 3/4] Fix build tags maybe? --- contrib/semver/version.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index a17cf6fe..2b3c4bc3 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -33,9 +33,6 @@ if [ $? != 0 ]; then exit 1 fi -# Get the number of merges on the current branch since the last tag -BUILD=$(git rev-list $TAG..HEAD --count --merges) - # Split out into major, minor and patch numbers MAJOR=$(echo $TAG | cut -c 2- | cut -d "." -f 1) MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2) @@ -54,6 +51,10 @@ else printf '%s%d.%d.%d' "$PREPEND" "$MAJOR" "$MINOR" "$PATCH" fi +# Get the number of merges on the current branch since the last tag +TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null) +BUILD=$(git rev-list $TAG..$BRANCH --count) + # Add the build tag on non-master branches if [ $BRANCH != "master" ]; then if [ $BUILD != 0 ]; then From 09ea9a166f988fdc784727a3f0134b854960a221 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Tue, 18 Dec 2018 12:14:47 +0000 Subject: [PATCH 4/4] More tweaks to semver --- contrib/semver/version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index 2b3c4bc3..03b5da2c 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -52,8 +52,8 @@ else fi # Get the number of merges on the current branch since the last tag -TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" 2>/dev/null) -BUILD=$(git rev-list $TAG..$BRANCH --count) +TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.[0-9]*" --first-parent master 2>/dev/null) +BUILD=$(git rev-list $TAG.. --count) # Add the build tag on non-master branches if [ $BRANCH != "master" ]; then @@ -62,6 +62,6 @@ if [ $BRANCH != "master" ]; then fi else if [ $BUILD != 0 ]; then - printf -- "-%d" "$BUILD" + printf -- "-%d" "$(($BUILD+1))" fi fi