Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
fixing tagged build
Browse files Browse the repository at this point in the history
  • Loading branch information
ojkelly committed Jul 4, 2018
1 parent 1e6e694 commit 916b7d6
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion .travis.yml
Expand Up @@ -26,8 +26,33 @@ script:
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci

before_deploy:
# Grab the cross compiler
- go get github.com/karalabe/xgo
- "./build/ci/build.sh"
- |
# Get the full go repo url
REPO=$(pwd | rev | cut -d'/' -f-3 | rev)
# Get the name of the app
APP="${PWD##*/}"
# Get this tag as the version
VERSION=$(git describe --abbrev=0 --tags)
# Ensure a fresh build folder
rm -rf build && mkdir build
# Compile
xgo \
-dest build/ \
--targets=darwin-10.11/amd64,freebsd/386,freebsd/amd64,freebsd/arm,linux/386,linux/amd64,linux/arm \
--ldflags "-X main.version=${VERSION}" \
$REPO
# Package
cd build
# For each compiled binary, we're repackaging it in a zip with the architecture name, and
# renaming the binary to the app name
for FILE in $(ls .); do
mv $FILE $APP
tar cvzf ${FILE}.tgz $APP
rm -f $APP
done
cd ..
deploy:
provider: releases
Expand Down

0 comments on commit 916b7d6

Please sign in to comment.