From 351ba9b107f501e163eb296320aa816aebd38d18 Mon Sep 17 00:00:00 2001 From: Shiming Zhang Date: Tue, 25 Jul 2023 16:46:13 +0800 Subject: [PATCH] Add release binaries --- .github/workflows/release.yaml | 7 +++++++ Makefile | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0e04d9907..fa906d4d4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,3 +24,10 @@ jobs: _output/components.yaml _output/high-availability.yaml _output/high-availability-1.21+.yaml + - name: Build binaries + run: make release-binaries + - name: Release + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 + with: + files: | + _output/metrics-server-* diff --git a/Makefile b/Makefile index 818e9e99f..b88bbee3a 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ BUILD_DATE:=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') ALL_ARCHITECTURES=amd64 arm arm64 ppc64le s390x export DOCKER_CLI_EXPERIMENTAL=enabled +BINARIES_ARCHITECTURES=amd64 arm64 +BINARIES_PLATFORMS=linux darwin windows + # Tools versions # -------------- GOLANGCI_VERSION:=1.53.2 @@ -95,6 +98,19 @@ release-manifests: kubectl kustomize manifests/overlays/release-ha > _output/high-availability.yaml kubectl kustomize manifests/overlays/release-ha-1.21+ > _output/high-availability-1.21+.yaml +.PHONY: release-binaries +release-binaries: + @mkdir -p _output + @for arch in $(BINARIES_ARCHITECTURES); do \ + for platform in $(BINARIES_PLATFORMS); do \ + binary_name=metrics-server-$${platform}-$${arch}; \ + if [ "$${platform}" = "windows" ]; then \ + binary_name=$${binary_name}.exe; \ + fi; \ + GOARCH=$${arch} GOOS=$${platform} CGO_ENABLED=0 \ + go build -mod=readonly -ldflags "$(LDFLAGS)" -o $(REPO_DIR)/_output/$${binary_name} sigs.k8s.io/metrics-server/cmd/metrics-server; \ + done; \ + done # fuzz tests # ----------