Skip to content

Commit

Permalink
(+semver: fix) Add more artifact versions (#3)
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Benjamin <[email protected]>
  • Loading branch information
annymsMthd authored Aug 5, 2018
1 parent a859d28 commit e0c82cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
BUILD_PATH := artifacts/gogitver
LINUX_BUILD_PATH = $(BUILD_PATH)_linux
LINUX_ARM_BUILD_PATH = $(LINUX_BUILD_PATH)-arm
WINDOWS_BUILD_PATH = $(BUILD_PATH)_windows.exe

version: build
$(BUILD_PATH)
$(LINUX_BUILD_PATH)

deps:
@which dep 2>/dev/null || go get -u ./...
@dep ensure -v

build:
@go build -o $(BUILD_PATH) cmd/gogitver/main.go
GOOS=linux GOARCH=amd64 go build -o $(LINUX_BUILD_PATH) cmd/gogitver/main.go
GOOS=linux GOARCH=arm go build -o $(LINUX_ARM_BUILD_PATH) cmd/gogitver/main.go
GOOS=windows GOARCH=amd64 go build -o $(WINDOWS_BUILD_PATH) cmd/gogitver/main.go

.PHONY: version
5 changes: 3 additions & 2 deletions pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ type gitVersion struct {
PatchBump bool
}

// GetCurrentVerion returns the current version
func GetCurrentVerion(path string) (version string, err error) {
tag, ok := os.LookupEnv("TRAVIS_TAG") // If this is a tagged build in travis shortcircuit here
if ok && tag != "" {
tag, ok := os.LookupEnv("TRAVIS_TAG")
if ok && tag != "" { // If this is a tagged build in travis shortcircuit here
version, err := semver.NewVersion(tag)
if err != nil {
return "", err
Expand Down

0 comments on commit e0c82cd

Please sign in to comment.