From dfa828468be3f063345fbad8963a7c0e99dd626d Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Sat, 24 Nov 2018 19:43:22 +0000 Subject: [PATCH] releasing --- .circleci/config.yml | 9 --------- Makefile | 6 ++---- config.go | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a08c8c3..6462c9c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,6 @@ jobs: - run: make test build-linux: docker: - # specify the version - image: liamg/golang-opengl working_directory: /go/src/github.com/liamg/aminal requires: @@ -22,25 +21,18 @@ jobs: - checkout - run: make build-linux - persist_to_workspace: - # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is - # taken to be the root directory of the workspace. root: . - # Must be relative path from root paths: - bin/linux build-darwin: docker: - # specify the version - image: karalabe/xgo-latest:latest working_directory: /go/src/github.com/liamg/aminal steps: - checkout - run: make build-darwin - persist_to_workspace: - # Must be an absolute path, or relative path from working_directory. This is a directory on the container which is - # taken to be the root directory of the workspace. root: . - # Must be relative path from root paths: - bin/darwin release: @@ -48,7 +40,6 @@ jobs: - image: circleci/golang:latest steps: - attach_workspace: - # Must be absolute path or relative path from working_directory at: ./workspace - run: name: "Publish Release on GitHub" diff --git a/Makefile b/Makefile index 67ec9dd..d844153 100644 --- a/Makefile +++ b/Makefile @@ -31,11 +31,9 @@ update-fonts: install-tools .PHONY: build-linux build-linux: mkdir -p bin/linux - GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o bin/${BINARY}-linux-amd64 + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o bin/${BINARY}-linux-amd64 -ldflags "-X main.Version=`${CIRCLE_TAG}` .PHONY: build-darwin build-darwin: mkdir -p bin/darwin - xgo --targets=darwin/amd64 --dest=bin/darwin -out ${BINARY}-darwin-amd64 . - - + xgo -ldflags "-X main.Version=`${CIRCLE_TAG}` --targets=darwin/amd64 --dest=bin/darwin -out ${BINARY}-darwin-amd64 . diff --git a/config.go b/config.go index 07d4346..004cb1e 100644 --- a/config.go +++ b/config.go @@ -9,7 +9,13 @@ import ( "github.com/liamg/aminal/config" ) +var Version string + func getConfig() *config.Config { + + showVersion := false + flag.BoolVar(&showVersion, "version", showVersion, "Output version information") + ignore := false flag.BoolVar(&ignore, "ignore-config", ignore, "Ignore user config files and use defauls") if ignore { @@ -23,6 +29,15 @@ func getConfig() *config.Config { flag.BoolVar(&conf.Slomo, "slomo", conf.Slomo, "Render in slow motion (useful for debugging)") flag.Parse() + + if showVersion { + if Version == "" { + Version = "development" + } + fmt.Printf("Aminal %s\n", Version) + os.Exit(0) + } + return conf }