5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 18:50:27 +00:00

Merge pull request #34 from neilalexander/master

Tag CircleCI build artifacts with version and branch
This commit is contained in:
Neil Alexander 2018-03-04 11:17:47 +00:00 committed by GitHub
commit 57777b6152
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 13 deletions

View File

@ -12,35 +12,39 @@ jobs:
steps: steps:
- checkout - checkout
- run: - run:
name: Create artifact upload directory name: Create artifact upload directory and set variables
command: mkdir /tmp/upload command: |
mkdir /tmp/upload
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
- run: - run:
name: Build for Linux (including Debian packages) name: Build for Linux (including Debian packages)
command: | command: |
PKGARCH=amd64 sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-linux-amd64; 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-linux-i386; 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-linux-mipsel; 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-linux-mips; PKGARCH=mips sh contrib/deb/generate.sh && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-mips;
mv *.deb /tmp/upload/ mv *.deb /tmp/upload/
- run: - run:
name: Build for macOS name: Build for macOS
command: | command: |
GOOS=darwin GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-darwin-amd64; GOOS=darwin GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-darwin-amd64;
GOOS=darwin GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-darwin-i386; GOOS=darwin GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-darwin-i386;
- run: - run:
name: Build for OpenBSD name: Build for OpenBSD
command: | command: |
GOOS=openbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-linux-amd64; GOOS=openbsd GOARCH=amd64 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-amd64;
GOOS=openbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-linux-i386; GOOS=openbsd GOARCH=386 ./build && mv yggdrasil /tmp/upload/yggdrasil-$CIVERSION-linux-i386;
- run: - run:
name: Build for Windows name: Build for Windows
command: | command: |
GOOS=windows GOARCH=amd64 ./build && mv yggdrasil.exe /tmp/upload/yggdrasil-windows-amd64.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-windows-i386.exe; GOOS=windows GOARCH=386 ./build && mv yggdrasil.exe /tmp/upload/yggdrasil-$CIVERSION-windows-i386.exe;
- run: - run:
name: Build for EdgeRouter name: Build for EdgeRouter

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.1

View File

@ -14,7 +14,7 @@ PKGBRANCH=$(basename `git name-rev --name-only HEAD`)
if [ "$PKGBRANCH" = "master" ]; then PKGNAME=yggdrasil if [ "$PKGBRANCH" = "master" ]; then PKGNAME=yggdrasil
else PKGNAME=yggdrasil-${PKGBRANCH}; fi else PKGNAME=yggdrasil-${PKGBRANCH}; fi
PKGARCH=${PKGARCH-amd64} 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 PKGFILE=$PKGNAME-$PKGVERSION-$PKGARCH.deb
if [ $PKGARCH = "amd64" ]; then GOARCH=amd64 GOOS=linux ./build if [ $PKGARCH = "amd64" ]; then GOARCH=amd64 GOOS=linux ./build