mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-12-22 07:57:31 +00:00
Merge pull request #267 from neilalexander/arghsemver
CircleCI: don't recreate tags that already exist
This commit is contained in:
commit
631f1fe907
@ -103,7 +103,7 @@ jobs:
|
|||||||
name: Create tags (master branch only)
|
name: Create tags (master branch only)
|
||||||
command: >
|
command: >
|
||||||
if [ "${CIRCLE_BRANCH}" == "master" ]; then
|
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
|
else
|
||||||
echo "Only runs for master branch (this is ${CIRCLE_BRANCH})";
|
echo "Only runs for master branch (this is ${CIRCLE_BRANCH})";
|
||||||
fi;
|
fi;
|
||||||
|
@ -33,9 +33,6 @@ if [ $? != 0 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Split out into major, minor and patch numbers
|
||||||
MAJOR=$(echo $TAG | cut -c 2- | cut -d "." -f 1)
|
MAJOR=$(echo $TAG | cut -c 2- | cut -d "." -f 1)
|
||||||
MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2)
|
MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2)
|
||||||
@ -54,9 +51,17 @@ else
|
|||||||
printf '%s%d.%d.%d' "$PREPEND" "$MAJOR" "$MINOR" "$PATCH"
|
printf '%s%d.%d.%d' "$PREPEND" "$MAJOR" "$MINOR" "$PATCH"
|
||||||
fi
|
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]*" --first-parent master 2>/dev/null)
|
||||||
|
BUILD=$(git rev-list $TAG.. --count)
|
||||||
|
|
||||||
# Add the build tag on non-master branches
|
# Add the build tag on non-master branches
|
||||||
if [ $BRANCH != "master" ]; then
|
if [ $BRANCH != "master" ]; then
|
||||||
if [ $BUILD != 0 ]; then
|
if [ $BUILD != 0 ]; then
|
||||||
printf -- "-%04d" "$BUILD"
|
printf -- "-%04d" "$BUILD"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [ $BUILD != 0 ]; then
|
||||||
|
printf -- "-%d" "$(($BUILD+1))"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user