Skip to content

Commit

Permalink
Merge pull request #43 from garethjevans/better-dev-version
Browse files Browse the repository at this point in the history
chore: set a better development version when building locally
  • Loading branch information
garethjevans authored Oct 26, 2022
2 parents e3e0a70 + 1e17ed5 commit d0efd2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
SHELL := /bin/sh
BINARY_NAME := kubectl-permissions
REV := $(shell git rev-parse --short HEAD 2> /dev/null || echo 'unknown')
GIT_TREE_STATE := $(shell test -z "`git status --porcelain`" && echo "clean" || echo "dirty")

VERSION ?= $(shell echo "$$(git for-each-ref refs/tags/ --count=1 --sort=-version:refname --format='%(refname:short)' 2>/dev/null)-dev+$(REV)-$(GIT_TREE_STATE)" | sed 's/^v//')

build:
go build -o kubectl-permissions -trimpath -ldflags "-X github.com/garethjevans/kubectl-permissions/pkg/version.Version=dev" cmd/kubectl-permissions.go
go build -o $(BINARY_NAME) -trimpath -ldflags "-X github.com/garethjevans/kubectl-permissions/pkg/version.Version=$(VERSION)" cmd/kubectl-permissions.go

install: build
sudo cp -f kubectl-permissions /usr/local/bin
sudo cp -f $(BINARY_NAME) /usr/local/bin

lint:
golangci-lint run
Expand Down

0 comments on commit d0efd2a

Please sign in to comment.