From a7f5c427d467f9f5db984a3eba6c1a0e7ccd26a7 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 3 Dec 2018 17:44:26 +0000 Subject: [PATCH 1/2] Tag releases in master using CI (also checks for v0.x.0 instead of v0.x when deciding version numbers) --- .circleci/config.yml | 12 ++++++++++++ contrib/.DS_Store | Bin 0 -> 6148 bytes contrib/semver/version.sh | 11 +++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 contrib/.DS_Store diff --git a/.circleci/config.yml b/.circleci/config.yml index fa5ebca..90bba23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -18,6 +18,8 @@ jobs: mkdir /tmp/upload echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV echo 'export CIVERSION=$(sh contrib/semver/version.sh | cut -c 2-)' >> $BASH_ENV + git config --global user.email "$(git log --format='%ae' HEAD -1)"; + git config --global user.name "$(git log --format='%an' HEAD -1)"; - run: name: Install alien @@ -98,3 +100,13 @@ jobs: - store_artifacts: path: /tmp/upload destination: / + + - run: + 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; + else + echo "Only runs for master branch (this is ${CIRCLE_BRANCH})"; + fi; + when: on_success diff --git a/contrib/.DS_Store b/contrib/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..799616ae9f2aed17d20533c4052922a02fadaab9 GIT binary patch literal 6148 zcmeHKPfx-y6mJ2gV2m70)LSp!I50Kf#blXy@Mbcj2Q{!|C`)iNY)BL_`yBd>`~rR* z-)jpI(TfLT$a~A{@Ads@)8CeMWsGrW5Lk>=7-IqyF;{}-8^Jj0oaBrLk*hI$maxDd zCU<^sE}Iv_;EG-v>D2wuH`O59aLpSx( zLE?D*3+$bEY1cRQX&m>aw&$OPonfo8ei%oo7e<}FDh`7Vq+FhdQ4kNEcn}4N8pqWE zAxfgus%(u$)=sTnm6o+XuF6rPQLDd;Dx5!bYMy5Y@J&ip0yIR4T^$! nnZ{`e80sj7Ts(?5L6v}Cq5)_d%rt@rgnk4R4b%_=f6BlIbwN_$ literal 0 HcmV?d00001 diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index bd009a9..215753b 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -4,7 +4,7 @@ DEVELOPBRANCH="yggdrasil-network/develop" # Get the last tag -TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*" 2>/dev/null) +TAG=$(git describe --abbrev=0 --tags --match="v[0-9]*\.[0-9]*\.0" 2>/dev/null) # Get last merge to master MERGE=$(git rev-list $TAG..master --grep "from $DEVELOPBRANCH" 2>/dev/null | head -n 1) @@ -31,8 +31,12 @@ MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2) BRANCH=$(git rev-parse --abbrev-ref HEAD) # Output in the desired format -if [ $PATCH = 0 ]; then - printf 'v%d.%d' "$MAJOR" "$MINOR" +if [ $PATCH == 0 ]; then + if [ ! -z $FULL ]; then + printf 'v%d.%d.0' "$MAJOR" "$MINOR" + else + printf 'v%d.%d' "$MAJOR" "$MINOR" + fi else printf 'v%d.%d.%d' "$MAJOR" "$MINOR" "$PATCH" fi @@ -43,4 +47,3 @@ if [ $BRANCH != "master" ]; then printf -- "-%04d" "$BUILD" fi fi - From 8a04cbe3c8e9f9c05d35d728002addde5710c15d Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 3 Dec 2018 17:49:03 +0000 Subject: [PATCH 2/2] Try to fix CircleCI shell error --- contrib/semver/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/semver/version.sh b/contrib/semver/version.sh index 215753b..6eeffc5 100644 --- a/contrib/semver/version.sh +++ b/contrib/semver/version.sh @@ -31,7 +31,7 @@ MINOR=$(echo $TAG | cut -c 2- | cut -d "." -f 2) BRANCH=$(git rev-parse --abbrev-ref HEAD) # Output in the desired format -if [ $PATCH == 0 ]; then +if [ $PATCH = 0 ]; then if [ ! -z $FULL ]; then printf 'v%d.%d.0' "$MAJOR" "$MINOR" else