diff --git a/.travis.yml b/.travis.yml index 7aca9fa0f13c259c0541c17c067f1f681ea4a153..a52d863c9a4c35c1689588543f32b45ac1f4cc3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ before_deploy: # they failed to build. - go get github.com/mitchellh/gox - mkdir releases - - gox -osarch='!netbsd/arm !openbsd/386 !openbsd/amd64 !netbsd/386 !netbsd/amd64' -output="releases/{{.Dir}}_`git describe --tags --abbrev=0`_{{.OS}}_{{.Arch}}/{{.Dir}}" + - gox -osarch='!netbsd/arm !openbsd/386 !openbsd/amd64 !netbsd/386 !netbsd/amd64' -output="releases/{{.Dir}}_`git describe --tags --abbrev=0`_{{.OS}}_{{.Arch}}/{{.Dir}}" -ldflags "-X main.Version=`git describe --tags --abbrev=0`" # Loop through the built architecture directories and create their corresponding tar.gz archives with the binary in it. - find releases -maxdepth 2 -mindepth 2 -type f -exec bash -c 'tar -cvzf "$(dirname {}).tar.gz" -C "$(dirname {})" $(basename {})' \; diff --git a/main.go b/main.go index 521ee7be7270b2594a4551744947ab7d9dd0203e..13a7da13271cc60163f270e51f2565eca51f7f87 100644 --- a/main.go +++ b/main.go @@ -1,9 +1,22 @@ package main import ( + "flag" + "fmt" + "os" + "github.com/docker/machine/libmachine/drivers/plugin" ) +// Version will be added once we start the build process via travis-ci +var Version string + func main() { + version := flag.Bool("v", false, "prints current docker-machine-driver-hetzner version") + flag.Parse() + if *version { + fmt.Printf("Version: %s\n", Version) + os.Exit(0) + } plugin.RegisterDriver(NewDriver()) }