Skip to content

Commit f87a7b9

Browse files
Use more explicit artifact lists in build-release
Previously there was a double loop over both OS and ARCH, which then required some pattern matching exceptions to skip things like darwin+s390x, and renaming of the windows artifacts. Some of the syntax was having problems in the github actions workflow. Now, each OS gets its own loop, making things more clear and more adjustable in the future. Signed-off-by: Justin Kulikauskas <[email protected]>
1 parent ae26c6c commit f87a7b9

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

Makefile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,26 @@ build-release:
7070
echo "There are local modifications in the repo" > /dev/stderr; \
7171
exit 1; \
7272
fi
73-
@for OS in linux darwin windows; do for ARCH in amd64 arm64 ppc64le s390x; do \
74-
if [[ $${OS} != "linux" ]] && [[ $${ARCH} != *"64" ]]; then continue; fi; \
75-
echo "# Building $${OS}-$${ARCH}-PolicyGenerator"; \
76-
GOOS=$${OS} GOARCH=$${ARCH} CGO_ENABLED=0 \
77-
go build -mod=readonly -ldflags="$(GO_LDFLAGS)" -o build_output/$${OS}-$${ARCH}-PolicyGenerator ./cmd/PolicyGenerator \
78-
|| exit 1; \
79-
done; done
80-
# Adding .exe extension to Windows binaries
81-
@for FILE in $$(ls -1 build_output/windows-* | grep -v ".exe$$"); do \
82-
mv $${FILE} $${FILE}.exe \
83-
|| exit 1; \
73+
@for ARCH in amd64 arm64 ppc64le s390x; do \
74+
NAME="linux-$${ARCH}-PolicyGenerator"; \
75+
echo "# Building $${NAME}"; \
76+
GOOS=linux GOARCH=$${ARCH} CGO_ENABLED=0 \
77+
go build -mod=readonly -ldflags="$(GO_LDFLAGS)" -o build_output/$${NAME} ./cmd/PolicyGenerator \
78+
|| exit 1; \
79+
done
80+
@for ARCH in amd64 arm64; do \
81+
NAME="darwin-$${ARCH}-PolicyGenerator"; \
82+
echo "# Building $${NAME}"; \
83+
GOOS=darwin GOARCH=$${ARCH} CGO_ENABLED=0 \
84+
go build -mod=readonly -ldflags="$(GO_LDFLAGS)" -o build_output/$${NAME} ./cmd/PolicyGenerator \
85+
|| exit 1; \
86+
done
87+
@for ARCH in amd64 arm64; do \
88+
NAME="windows-$${ARCH}-PolicyGenerator.exe"; \
89+
echo "# Building $${NAME}"; \
90+
GOOS=windows GOARCH=$${ARCH} CGO_ENABLED=0 \
91+
go build -mod=readonly -ldflags="$(GO_LDFLAGS)" -o build_output/$${NAME} ./cmd/PolicyGenerator \
92+
|| exit 1; \
8493
done
8594

8695
.PHONY: generate

0 commit comments

Comments
 (0)