From 3deadee42e88ed137ffacf7dfc63be99198f63c6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 4 Mar 2018 01:29:00 +0000 Subject: [PATCH 1/3] Tag the build artifacts with version and branch --- .circleci/config.yml | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8cd85715..85512601 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,35 +12,39 @@ jobs: steps: - checkout - run: - name: Create artifact upload directory - command: mkdir /tmp/upload + name: Create artifact upload directory and set variables + command: | + mkdir /tmp/upload + echo 'export CIBUILD=0.$(git rev-list HEAD --count | xargs printf "%04d")' >> $BASH_ENV + echo 'export CIBRANCH=$(git name-rev --name-only HEAD)' >> $BASH_ENV + echo '[ "$CIBRANCH" != "master" ] && export CIVERSION=$CIBRANCH-$CIBUILD || export CIVERSION=$CIBUILD' >> $BASH_ENV - run: name: Build for Linux (including Debian packages) command: | - PKGARCH=amd64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-linux-amd64; - PKGARCH=i386 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-linux-i386; - PKGARCH=mipsel sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-linux-mipsel; - PKGARCH=mips sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-linux-mips; + PKGARCH=amd64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-amd64; + PKGARCH=i386 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-i386; + PKGARCH=mipsel sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-mipsel; + PKGARCH=mips sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-mips; mv *.deb /tmp/upload/ - run: name: Build for macOS command: | - GOOS=darwin GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-darwin-amd64; - GOOS=darwin GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-darwin-i386; + GOOS=darwin GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-darwin-amd64; + GOOS=darwin GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-darwin-i386; - run: name: Build for OpenBSD command: | - GOOS=openbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-linux-amd64; - GOOS=openbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-linux-i386; + GOOS=openbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-amd64; + GOOS=openbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-i386; - run: name: Build for Windows command: | - GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/yggdrasil-windows-amd64.exe; - GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/yggdrasil-windows-i386.exe; + GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/yggdrasil-$CIVERSION-windows-amd64.exe; + GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/yggdrasil-$CIVERSION-windows-i386.exe; - run: name: Build for EdgeRouter From 54a742d5763ba945e14892988145eebb5deec922 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 4 Mar 2018 10:58:10 +0000 Subject: [PATCH 2/3] Set explicit version in CIBUILD --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 85512601..8f2ad009 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: name: Create artifact upload directory and set variables command: | mkdir /tmp/upload - echo 'export CIBUILD=0.$(git rev-list HEAD --count | xargs printf "%04d")' >> $BASH_ENV + echo 'export CIBUILD=0.1.$(git rev-list HEAD --count | xargs printf "%04d")' >> $BASH_ENV echo 'export CIBRANCH=$(git name-rev --name-only HEAD)' >> $BASH_ENV echo '[ "$CIBRANCH" != "master" ] && export CIVERSION=$CIBRANCH-$CIBUILD || export CIVERSION=$CIBUILD' >> $BASH_ENV From e43776f90e81f841e267c8076f7d67439d8f5894 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 4 Mar 2018 11:09:17 +0000 Subject: [PATCH 3/3] Add version file --- .circleci/config.yml | 2 +- VERSION | 1 + contrib/deb/generate.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 VERSION diff --git a/.circleci/config.yml b/.circleci/config.yml index 8f2ad009..bc4b5cd4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -15,7 +15,7 @@ jobs: name: Create artifact upload directory and set variables command: | mkdir /tmp/upload - echo 'export CIBUILD=0.1.$(git rev-list HEAD --count | xargs printf "%04d")' >> $BASH_ENV + echo 'export CIBUILD=$(cat VERSION).$(git rev-list HEAD --count | xargs printf "%04d")' >> $BASH_ENV echo 'export CIBRANCH=$(git name-rev --name-only HEAD)' >> $BASH_ENV echo '[ "$CIBRANCH" != "master" ] && export CIVERSION=$CIBRANCH-$CIBUILD || export CIVERSION=$CIBUILD' >> $BASH_ENV diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..49d59571 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1 diff --git a/contrib/deb/generate.sh b/contrib/deb/generate.sh index e2c98208..6e58e875 100644 --- a/contrib/deb/generate.sh +++ b/contrib/deb/generate.sh @@ -14,7 +14,7 @@ PKGBRANCH=$(basename `git name-rev --name-only HEAD`) if [ "$PKGBRANCH" = "master" ]; then PKGNAME=yggdrasil else PKGNAME=yggdrasil-${PKGBRANCH}; fi PKGARCH=${PKGARCH-amd64} -PKGVERSION=0.$(git rev-list HEAD --count 2>/dev/null | xargs printf "%04d") +PKGVERSION=$(cat VERSION).$(git rev-list HEAD --count 2>/dev/null | xargs printf "%04d") PKGFILE=$PKGNAME-$PKGVERSION-$PKGARCH.deb if [ $PKGARCH = "amd64" ]; then GOARCH=amd64 GOOS=linux ./build