Skip to content

Commit 8f3b737

Browse files
author
Per Goncalves da Silva
committed
add custom release target for windows
Signed-off-by: Per Goncalves da Silva <[email protected]>
1 parent cab507b commit 8f3b737

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Diff for: Makefile

+18-1
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,27 @@ export LATEST_IMAGE_OR_EMPTY := $(shell \
139139
&& [ "$(shell echo -e "$(OPM_VERSION)\n$(LATEST_TAG)" | sort -rV | head -n1)" == "$(OPM_VERSION)" ] \
140140
&& echo "$(OPM_IMAGE_REPO):latest" || echo "")
141141
RELEASE_GOOS := $(shell go env GOOS)
142-
release: RELEASE_ARGS ?= release --rm-dist --snapshot -f release/goreleaser.$(RELEASE_GOOS).yaml
142+
RELEASE_ARGS ?= release --rm-dist --snapshot -f release/goreleaser.$(RELEASE_GOOS).yaml
143+
144+
# Note: bingo does not yet support windows (https://github.com/bwplotka/bingo/issues/26)
145+
# so GOOS=windows gets its own way to install goreleaser
146+
ifeq ($(RELEASE_GOOS), windows)
147+
GORELEASER := $(shell pwd)/bin/goreleaser
148+
release: windows-goreleaser-install
149+
else
143150
release: $(GORELEASER)
151+
endif
152+
release:
144153
$(GORELEASER) $(RELEASE_ARGS)
145154

155+
.PHONY: windows-goreleaser-install
156+
windows-goreleaser-install:
157+
# manually install goreleaser from the bingo directory in the same way bingo (currently) installs it.
158+
# This is done to ensure the same version of goreleaser is used across all platforms
159+
mkdir -p $(dir $(GORELEASER))
160+
@echo "(re)installing $(GORELEASER)"
161+
GOWORK=off $(GO) build -mod=mod -modfile=.bingo/goreleaser.mod -o=$(GORELEASER) "github.com/goreleaser/goreleaser"
162+
146163
# tagged-or-empty returns $(OPM_IMAGE_REPO):$(1) when HEAD is assigned a non-prerelease semver tag,
147164
# otherwise the empty string. An empty string causes goreleaser to skip building
148165
# the manifest image for a trunk commit when it is not a release commit.

0 commit comments

Comments
 (0)