Skip to content

Commit 2ddb7fd

Browse files
committed
fix(make): Command for updating version of utility so make install will add latest git tag version to version.go.
fix(dist): Updated release to set binary name to `kfutil`
1 parent 6b5c8e1 commit 2ddb7fd

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ builds:
2828
ignore:
2929
- goos: darwin
3030
goarch: '386'
31-
binary: '{{ .ProjectName }}_v{{ .Version }}'
31+
binary: 'kfutil'
3232
archives:
3333
- format: zip
3434
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'

GNUmakefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ NAMESPACE=keyfactor
66
WEBSITE_REPO=https://github.com/Keyfactor/kfutil
77
NAME=kfutil
88
BINARY=${NAME}
9-
VERSION=v0.0.4
9+
VERSION := $(GITHUB_REF_NAME)
10+
ifeq ($(VERSION),)
11+
VERSION := $(shell git tag -l | tail -n 1)
12+
endif
1013
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)
1114
BASEDIR := ${HOME}/go/bin
1215
INSTALLDIR := ${BASEDIR}
@@ -30,7 +33,7 @@ release:
3033
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386
3134
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64
3235

33-
install:
36+
install: fmt setversion
3437
go build -o ${BINARY}
3538
rm -rf ${INSTALLDIR}/${BINARY}
3639
mkdir -p ${INSTALLDIR}
@@ -41,6 +44,12 @@ install:
4144
vendor:
4245
go mod vendor
4346

47+
version:
48+
@echo ${VERSION}
49+
50+
setversion:
51+
sed -i '' -e 's/VERSION = ".*"/VERSION = "$(VERSION)"/' pkg/version/version.go
52+
4453
test:
4554
go test -i $(TEST) || exit 1
4655
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
@@ -54,4 +63,4 @@ prerelease:
5463
git tag $(VERSION)
5564
git push origin $(VERSION)
5665

57-
.PHONY: build prerelease release install test fmt vendor
66+
.PHONY: build prerelease release install test fmt vendor version setversion

pkg/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package version
22

3-
const VERSION = "v0.3.0"
3+
const VERSION = "v0.4.1"

0 commit comments

Comments
 (0)