1
1
# If you update this file, please follow
2
2
# https://suva.sh/posts/well-documented-makefiles
3
3
4
- # # --------------------------------------
5
- # # General
6
- # # --------------------------------------
7
-
8
4
.DEFAULT_GOAL := help
9
5
10
6
PACKAGE = $(shell go list -m)
@@ -19,7 +15,8 @@ LD_FLAGS = -s -w \
19
15
-X '$(PACKAGE ) /pkg/version.BinaryName=$(BINARY_NAME ) '
20
16
COMMON_BUILD_ARGS = -ldflags "$(LD_FLAGS ) "
21
17
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//')
23
20
OSES = darwin linux windows
24
21
ARCHS = amd64 arm64
25
22
@@ -57,8 +54,8 @@ build-all-platforms: clean tidy format ## Build the project for all platforms
57
54
GOOS=$(os ) GOARCH=$(arch ) go build $(COMMON_BUILD_ARGS ) -o $(BINARY_NAME ) -$(os ) -$(arch )$(if $(findstring windows,$(os ) ) ,.exe,) ./cmd/kubernetes-mcp-server; \
58
55
))
59
56
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
62
59
$(foreach os,$(OSES ) ,$(foreach arch,$(ARCHS ) , \
63
60
EXECUTABLE=./$(BINARY_NAME ) -$(os ) -$(arch )$(if $(findstring windows,$(os ) ) ,.exe,) ; \
64
61
DIRNAME=$(BINARY_NAME ) -$(os ) -$(arch ) ; \
@@ -67,7 +64,7 @@ npm: build-all-platforms ## Create the npm packages for each platform
67
64
))
68
65
69
66
.PHONY : npm-publish
70
- npm-publish : npm # # Publish the npm packages
67
+ npm-publish : npm-copy-binaries # # Publish the npm packages
71
68
$(foreach os,$(OSES ) ,$(foreach arch,$(ARCHS ) , \
72
69
DIRNAME=" $( BINARY_NAME) -$( os) -$( arch) " ; \
73
70
cd npm/$$ DIRNAME; \
0 commit comments