Skip to content

Commit

Permalink
Check for commit before printing and fix CI script (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
derekbekoe authored Feb 23, 2019
1 parent b82be04 commit 26f9201
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ os:
- osx
- windows

gobuild_args: -v -race -x -ldflags "-X github.com/derekbekoe/convey/cmd.VersionGitCommit=$TRAVIS_COMMIT -X github.com/derekbekoe/convey/cmd.VersionGitTag=$TRAVIS_TAG"

before_install:
- go get github.com/mitchellh/gox

script:
- go test ${gobuild_args} ./...
- go test -v ./...
- mkdir bin
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then gox ${gobuild_args} -os="linux" -arch="amd64" -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then gox ${gobuild_args} -os="darwin" -arch="amd64" -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"; fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then gox ${gobuild_args} -os="windows" -arch="amd64" -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"; fi
- GOX_OS_NAME=$TRAVIS_OS_NAME
- if [[ "$GOX_OS_NAME" == "osx" ]]; then GOX_OS_NAME="darwin"; fi
- gox -ldflags "-X github.com/derekbekoe/convey/cmd.VersionGitCommit=$TRAVIS_COMMIT -X github.com/derekbekoe/convey/cmd.VersionGitTag=$TRAVIS_TAG" -os="$GOX_OS_NAME" -arch="amd64" -output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"

deploy:
provider: releases
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ get.convey.sh/linux

get.convey.sh/windows

wget -qO convey https://github.com/derekbekoe/convey/releases/download/VERSION/PLATFORM

e.g.:
wget -qO convey https://github.com/derekbekoe/convey/releases/download/v0.0.1/convey_linux_amd64
wget -qO convey https://github.com/derekbekoe/convey/releases/download/v0.0.1/convey_darwin_amd64

This will download the latest release for your platform.

## Usage
Expand Down
7 changes: 4 additions & 3 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of Convey",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Convey %s -- %s\n\n", VersionGitTag, VersionGitCommit[:7])
fmt.Printf("Commit: %s\n", VersionGitCommit)
if VersionGitCommit != "" {
fmt.Printf("Convey %s -- %s\n\n", VersionGitTag, VersionGitCommit[:7])
fmt.Printf("Commit: %s\n", VersionGitCommit)
}
fmt.Printf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
fmt.Printf("Go version: %s\n", runtime.Version())

},
}

0 comments on commit 26f9201

Please sign in to comment.