Skip to content

Commit

Permalink
version in binary
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickalin committed Jul 21, 2017
1 parent 3953b89 commit ec3630a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ deploy:
- bin/goBloomsky-windows-386.exe
- bin/goBloomsky-windows-amd64.exe
- config.yaml
- server.crt
- server.key
skip_cleanup: true
on:
tags: true
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.3
v1.3
12 changes: 9 additions & 3 deletions scripts/build/gen-ldflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"os/exec"
"strings"
"time"
"io/ioutil"
)

func genLDFlags(version string) string {
Expand All @@ -37,10 +38,15 @@ func genLDFlags(version string) string {

// genReleaseTag prints release tag to the console for easy git tagging.
func releaseTag(version string) string {
relPrefix := "DEVELOPMENT"
if prefix := os.Getenv("BLOOMSKY_RELEASE"); prefix != "" {
//relPrefix := "DEVELOPMENT"
dat, err := ioutil.ReadFile("VERSION")
if err != nil {
panic(err)
}
relPrefix := string(dat)
/*if prefix := os.Getenv("BLOOMSKY_RELEASE"); prefix != "" {
relPrefix = prefix
}
}*/

relTag := strings.Replace(version, " ", "-", -1)
relTag = strings.Replace(relTag, ":", "-", -1)
Expand Down
4 changes: 3 additions & 1 deletion scripts/travis/compile.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
LDFLAGS="$(go run scripts/build/gen-ldflags.go)"

go generate

echo "compile each binary"
Expand All @@ -16,7 +18,7 @@ for GOOS in darwin linux windows; do
export GOOS=$GOOS
export GOARCH=$GOARCH
export CGO_ENABLED=0
go build -o $TRAVIS_BUILD_DIR/bin/goBloomsky-$GOOS-$GOARCH -ldflags "-X main.Version=`cat VERSION`"
go build -o $TRAVIS_BUILD_DIR/bin/goBloomsky-$GOOS-$GOARCH --ldflags "${LDFLAGS}"
done
done
mv bin/goBloomsky-darwin-386 bin/goBloomsky-darwin-386.bin
Expand Down

0 comments on commit ec3630a

Please sign in to comment.