Skip to content

Commit 537f2e7

Browse files
committed
Add a Make target to build the binaries for a release
The output of this command is in the ./build_output directory. These binaries can be uploaded to the GitHub release. Signed-off-by: mprahl <[email protected]>
1 parent 3cb9559 commit 537f2e7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ API_PLUGIN_PATH ?= $(KUSTOMIZE_PLUGIN_HOME)/policy.open-cluster-management.io/v1
2222
# Kustomize arguments
2323
SOURCE_DIR ?= examples/
2424

25-
.PHONY: build build-binary generate layout fmt lint lint-dependencies test
25+
.PHONY: build build-binary build-release generate layout fmt lint lint-dependencies test
2626

2727
include build/common/Makefile.common.mk
2828

@@ -36,6 +36,17 @@ build: layout
3636
build-binary:
3737
go build -o PolicyGenerator cmd/main.go
3838

39+
build-release:
40+
@if [[ $(shell git status --porcelain | wc -l) -gt 0 ]]; \
41+
then \
42+
echo "There are local modifications in the repo" > /dev/stderr; \
43+
exit 1; \
44+
fi
45+
@mkdir -p build_output
46+
GOOS=linux GOARCH=amd64 go build -o build_output/linux-amd64-PolicyGenerator cmd/main.go
47+
GOOS=darwin GOARCH=amd64 go build -o build_output/darwin-amd64-PolicyGenerator cmd/main.go
48+
GOOS=windows GOARCH=amd64 go build -o build_output/windows-amd64-PolicyGenerator.exe cmd/main.go
49+
3950
generate:
4051
@KUSTOMIZE_PLUGIN_HOME=$(KUSTOMIZE_PLUGIN_HOME) kustomize build --enable-alpha-plugins $(SOURCE_DIR)
4152

0 commit comments

Comments
 (0)