Skip to content

Commit

Permalink
Fix version and release date
Browse files Browse the repository at this point in the history
  • Loading branch information
maraino committed Jan 25, 2023
1 parent 8ec4b07 commit e5e5ffc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X cmd.Version={{.Version}} -X cmd.BuildTime={{.Date}}
- -s -w -X {{.ModulePath}}/cmd.Version={{.Version}} -X {{.ModulePath}}/cmd.ReleaseDate={{.Date}}
- id: linux-arm64
main: ./main.go
binary: step-kms-plugin
Expand All @@ -33,7 +33,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X cmd.Version={{.Version}} -X cmd.BuildTime={{.Date}}
- -s -w -X {{.ModulePath}}/cmd.Version={{.Version}} -X {{.ModulePath}}/cmd.ReleaseDate={{.Date}}
- id: darwin-amd64
main: ./main.go
binary: step-kms-plugin
Expand All @@ -47,7 +47,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X cmd.Version={{.Version}} -X cmd.BuildTime={{.Date}}
- -s -w -X {{.ModulePath}}/cmd.Version={{.Version}} -X {{.ModulePath}}/cmd.ReleaseDate={{.Date}}
- id: darwin-arm64
main: ./main.go
binary: step-kms-plugin
Expand All @@ -61,7 +61,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X cmd.Version={{.Version}} -X cmd.BuildTime={{.Date}}
- -s -w -X {{.ModulePath}}/cmd.Version={{.Version}} -X {{.ModulePath}}/cmd.ReleaseDate={{.Date}}
- id: windows-amd64
main: ./main.go
binary: step-kms-plugin
Expand All @@ -75,7 +75,7 @@ builds:
flags:
- -trimpath
ldflags:
- -s -w -X cmd.Version={{.Version}} -X cmd.BuildTime={{.Date}}
- -s -w -X {{.ModulePath}}/cmd.Version={{.Version}} -X {{.ModulePath}}/cmd.ReleaseDate={{.Date}}

archives:
- id: step-kms-plugin
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@ VERSION ?= $(shell [ -d .git ] && git describe --tags --always --dirty="-dev")
endif

VERSION := $(shell echo $(VERSION) | sed 's/^v//')
DATE := $(shell date -u '+%Y-%m-%d %H:%M UTC')

ifdef V
$(info GITHUB_REF is $(GITHUB_REF))
$(info VERSION is $(VERSION))
$(info DATE is $(DATE))
endif

#########################################
# Build
#########################################

DATE := $(shell date -u '+%Y-%m-%d %H:%M UTC')
LDFLAGS := -ldflags='-w -X "cmd.Version=$(VERSION)" -X "cmd.BuildTime=$(DATE)"'
LDFLAGS := -ldflags='-s -w -X "$(PKG)/cmd.Version=$(VERSION)" -X "$(PKG)/cmd.ReleaseDate=$(DATE)"'

build:
$Q mkdir -p $(@D)
$Q go build -v -o $(PREFIX)bin/$(BINNAME) $(LDFLAGS) $(PKG)
@echo "Build Complete!"

Expand Down

0 comments on commit e5e5ffc

Please sign in to comment.