Skip to content

Commit

Permalink
Add Windows Support (#172)
Browse files Browse the repository at this point in the history
Adds a Windows build target
  • Loading branch information
bdwyertech authored and nickatsegment committed Nov 16, 2018
1 parent 20d4395 commit f55b7d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LDFLAGS := -ldflags='-X "main.Version=$(VERSION)" -X "main.AnalyticsWriteKey=$(A
test:
GO111MODULE=on go test -v ./...

all: dist/chamber-$(VERSION)-darwin-amd64 dist/chamber-$(VERSION)-linux-amd64
all: dist/chamber-$(VERSION)-darwin-amd64 dist/chamber-$(VERSION)-linux-amd64 dist/chamber-$(VERSION)-windows-amd64.exe

clean:
rm -rf ./dist
Expand All @@ -25,4 +25,7 @@ dist/chamber-$(VERSION)-darwin-amd64: | dist/
dist/chamber-$(VERSION)-linux-amd64: | dist/
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build $(LDFLAGS) -o $@

dist/chamber-$(VERSION)-windows-amd64.exe: | dist/
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 GO111MODULE=on go build $(LDFLAGS) -o $@

.PHONY: clean all
18 changes: 14 additions & 4 deletions Makefile.release
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PACKAGECLOUD_RPM_DISTROS := \

publish: publish-github publish-packagecloud

publish-github: publish-github-darwin publish-github-linux publish-github-deb publish-github-rpm publish-github-sha256sums
publish-github: publish-github-darwin publish-github-linux publish-github-windows publish-github-deb publish-github-rpm publish-github-sha256sums

publish-packagecloud: publish-packagecloud-deb publish-packagecloud-rpm

Expand Down Expand Up @@ -54,6 +54,15 @@ publish-github-linux: dist/chamber-$(VERSION)-linux-amd64 | github-release
--name chamber-$(VERSION)-linux-amd64 \
--file $<

publish-github-windows: dist/chamber-$(VERSION)-windows-amd64.exe | github-release
github-release upload \
--security-token $$GH_LOGIN \
--user segmentio \
--repo chamber \
--tag $(VERSION) \
--name chamber-$(VERSION)-windows-amd64.exe \
--file $<

publish-github-deb: dist/chamber_$(VERSION)_amd64.deb | github-release
github-release upload \
--security-token $$GH_LOGIN \
Expand All @@ -71,7 +80,7 @@ publish-github-rpm: dist/chamber_$(VERSION)_amd64.rpm | github-release
--tag $(VERSION) \
--name chamber_$(VERSION)_amd64.rpm \
--file $<

publish-github-sha256sums: dist/chamber-$(VERSION).sha256sums | github-release
github-release upload \
--security-token $$GH_LOGIN \
Expand Down Expand Up @@ -99,9 +108,9 @@ publish-packagecloud-rpm: dist/chamber_$(VERSION)_amd64.rpm packagecloud.conf.js
grep -v 'with token:' ; \
done

dist: dist/chamber-$(VERSION)-darwin-amd64 dist/chamber-$(VERSION)-linux-amd64 dist/chamber_$(VERSION)_amd64.deb dist/chamber_$(VERSION)_amd64.rpm dist/chamber-$(VERSION).sha256sums
dist: dist/chamber-$(VERSION)-darwin-amd64 dist/chamber-$(VERSION)-linux-amd64 dist/chamber-$(VERSION)-windows-amd64.exe dist/chamber_$(VERSION)_amd64.deb dist/chamber_$(VERSION)_amd64.rpm dist/chamber-$(VERSION).sha256sums

dist/chamber-$(VERSION).sha256sums: dist/chamber-$(VERSION)-darwin-amd64 dist/chamber-$(VERSION)-linux-amd64 dist/chamber_$(VERSION)_amd64.deb dist/chamber_$(VERSION)_amd64.rpm
dist/chamber-$(VERSION).sha256sums: dist/chamber-$(VERSION)-darwin-amd64 dist/chamber-$(VERSION)-linux-amd64 dist/chamber-$(VERSION)-windows-amd64.exe dist/chamber_$(VERSION)_amd64.deb dist/chamber_$(VERSION)_amd64.rpm
sha256sum $^ | sed 's|dist/||g' > $@

dist/nfpm-$(VERSION).yaml: | dist/
Expand All @@ -116,6 +125,7 @@ dist/chamber_$(VERSION)_amd64.rpm: dist/nfpm-$(VERSION).yaml dist/chamber-$(VERS
.PHONY: \
publish-github \
publish-github-linux \
publish-github-windows \
publish-github-rpm \
publish-github-deb \
publish-github-darwin \
Expand Down

0 comments on commit f55b7d2

Please sign in to comment.