Skip to content

Commit 30951a3

Browse files
committed
fix: npm versions shouldn't have -dirty flag
1 parent 183f725 commit 30951a3

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

Makefile

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# If you update this file, please follow
22
# https://suva.sh/posts/well-documented-makefiles
33

4-
## --------------------------------------
5-
## General
6-
## --------------------------------------
7-
84
.DEFAULT_GOAL := help
95

106
PACKAGE = $(shell go list -m)
@@ -19,7 +15,8 @@ LD_FLAGS = -s -w \
1915
-X '$(PACKAGE)/pkg/version.BinaryName=$(BINARY_NAME)'
2016
COMMON_BUILD_ARGS = -ldflags "$(LD_FLAGS)"
2117

22-
NPM_VERSION ?= $(shell echo $(GIT_VERSION) | sed 's/^v//')
18+
# NPM version should not append the -dirty flag
19+
NPM_VERSION ?= $(shell echo $(shell git describe --tags --always) | sed 's/^v//')
2320
OSES = darwin linux windows
2421
ARCHS = amd64 arm64
2522

@@ -57,8 +54,8 @@ build-all-platforms: clean tidy format ## Build the project for all platforms
5754
GOOS=$(os) GOARCH=$(arch) go build $(COMMON_BUILD_ARGS) -o $(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,) ./cmd/kubernetes-mcp-server; \
5855
))
5956

60-
.PHONY: npm
61-
npm: build-all-platforms ## Create the npm packages for each platform
57+
.PHONY: npm-copy-binaries
58+
npm-copy-binaries: build-all-platforms ## Copy the binaries to each npm package
6259
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
6360
EXECUTABLE=./$(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,); \
6461
DIRNAME=$(BINARY_NAME)-$(os)-$(arch); \
@@ -67,7 +64,7 @@ npm: build-all-platforms ## Create the npm packages for each platform
6764
))
6865

6966
.PHONY: npm-publish
70-
npm-publish: npm ## Publish the npm packages
67+
npm-publish: npm-copy-binaries ## Publish the npm packages
7168
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
7269
DIRNAME="$(BINARY_NAME)-$(os)-$(arch)"; \
7370
cd npm/$$DIRNAME; \

0 commit comments

Comments
 (0)