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
106PACKAGE = $(shell go list -m)
@@ -19,7 +15,8 @@ LD_FLAGS = -s -w \
1915 -X '$(PACKAGE ) /pkg/version.BinaryName=$(BINARY_NAME ) '
2016COMMON_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//')
2320OSES = darwin linux windows
2421ARCHS = 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