Skip to content

Commit

Permalink
Build fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Henderson <[email protected]>
  • Loading branch information
hairyhenderson committed May 22, 2020
1 parent 8a45304 commit ed380be
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 13 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,16 @@ jobs:
run: |
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=hairyhenderson/gomplate BUILDX_ACTION=--push
docker buildx imagetools create -t localhost:5000/gomplate:stable localhost:5000/gomplate:latest
docker buildx imagetools create -t localhost:5000/gomplate:${git_tag} localhost:5000/gomplate:latest
docker buildx imagetools create -t localhost:5000/gomplate:${major_version} localhost:5000/gomplate:latest
set -x
docker buildx imagetools create -t hairyhenderson/gomplate:stable hairyhenderson/gomplate:latest
docker buildx imagetools create -t hairyhenderson/gomplate:${git_tag} hairyhenderson/gomplate:latest
docker buildx imagetools create -t hairyhenderson/gomplate:${major_version} hairyhenderson/gomplate:latest
docker buildx imagetools create -t localhost:5000/gomplate:stable-slim localhost:5000/gomplate:slim
docker buildx imagetools create -t localhost:5000/gomplate:${git_tag}-slim localhost:5000/gomplate:slim
docker buildx imagetools create -t localhost:5000/gomplate:${major_version}-slim localhost:5000/gomplate:slim
docker buildx imagetools create -t hairyhenderson/gomplate:stable-slim hairyhenderson/gomplate:slim
docker buildx imagetools create -t hairyhenderson/gomplate:${git_tag}-slim hairyhenderson/gomplate:slim
docker buildx imagetools create -t hairyhenderson/gomplate:${major_version}-slim hairyhenderson/gomplate:slim
docker buildx imagetools create -t localhost:5000/gomplate:stable-alpine localhost:5000/gomplate:alpine
docker buildx imagetools create -t localhost:5000/gomplate:${git_tag}-alpine localhost:5000/gomplate:alpine
docker buildx imagetools create -t localhost:5000/gomplate:${major_version}-alpine localhost:5000/gomplate:alpine
docker buildx imagetools create -t hairyhenderson/gomplate:stable-alpine hairyhenderson/gomplate:alpine
docker buildx imagetools create -t hairyhenderson/gomplate:${git_tag}-alpine hairyhenderson/gomplate:alpine
docker buildx imagetools create -t hairyhenderson/gomplate:${major_version}-alpine hairyhenderson/gomplate:alpine
if: github.repository == 'hairyhenderson/gomplate' && env.is_tag == 'true'
48 changes: 44 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ GOARM ?= $(subst v,,$(TARGETVARIANT))
endif
endif

# platforms := freebsd-amd64 linux-amd64 linux-386 linux-armv5 linux-armv6 linux-armv7 linux-arm64 darwin-amd64 solaris-amd64 windows-amd64.exe windows-386.exe
platforms := freebsd-amd64 linux-amd64 linux-386 linux-armv6 linux-armv7 linux-arm64 darwin-amd64 solaris-amd64 windows-amd64.exe windows-386.exe
compressed-platforms := linux-amd64-slim linux-armv6-slim linux-armv7-slim linux-arm64-slim darwin-amd64-slim windows-amd64-slim.exe

Expand All @@ -54,12 +55,23 @@ $(PREFIX)/bin/$(PKG_NAME)_%-slim: $(PREFIX)/bin/$(PKG_NAME)_%
$(PREFIX)/bin/$(PKG_NAME)_%-slim.exe: $(PREFIX)/bin/$(PKG_NAME)_%.exe
upx --lzma $< -o $@

$(PREFIX)/bin/$(PKG_NAME)_%_checksum.txt: $(PREFIX)/bin/$(PKG_NAME)_%
$(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha256.txt: $(PREFIX)/bin/$(PKG_NAME)_%
@sha256sum $< > $@

$(PREFIX)/bin/checksums.txt: \
$(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%_checksum.txt,$(platforms)) \
$(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%_checksum.txt,$(compressed-platforms))
$(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha512.txt: $(PREFIX)/bin/$(PKG_NAME)_%
@sha512sum $< > $@

$(PREFIX)/bin/checksums.txt: $(PREFIX)/bin/checksums_sha256.txt
@cp $< $@

$(PREFIX)/bin/checksums_sha256.txt: \
$(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha256.txt,$(platforms)) \
$(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha256.txt,$(compressed-platforms))
@cat $^ > $@

$(PREFIX)/bin/checksums_sha512.txt: \
$(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha512.txt,$(platforms)) \
$(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha512.txt,$(compressed-platforms))
@cat $^ > $@

$(PREFIX)/%.signed: $(PREFIX)/%
Expand Down Expand Up @@ -103,6 +115,34 @@ build-release: artifacts.cid

docker-images: gomplate.iid gomplate-slim.iid

$(PREFIX)/bin/$(PKG_NAME)_%v5$(call extension,$(GOOS)): $(shell find $(PREFIX) -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) GOARCH=$(shell echo $* | cut -f2 -d- ) GOARM=5 CGO_ENABLED=0 \
$(GO) build \
-ldflags "-w -s $(COMMIT_FLAG) $(VERSION_FLAG)" \
-o $@ \
./cmd/gomplate

$(PREFIX)/bin/$(PKG_NAME)_%v6$(call extension,$(GOOS)): $(shell find $(PREFIX) -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) GOARCH=$(shell echo $* | cut -f2 -d- ) GOARM=6 CGO_ENABLED=0 \
$(GO) build \
-ldflags "-w -s $(COMMIT_FLAG) $(VERSION_FLAG)" \
-o $@ \
./cmd/gomplate

$(PREFIX)/bin/$(PKG_NAME)_%v7$(call extension,$(GOOS)): $(shell find $(PREFIX) -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) GOARCH=$(shell echo $* | cut -f2 -d- ) GOARM=7 CGO_ENABLED=0 \
$(GO) build \
-ldflags "-w -s $(COMMIT_FLAG) $(VERSION_FLAG)" \
-o $@ \
./cmd/gomplate

$(PREFIX)/bin/$(PKG_NAME)_windows-%.exe: $(shell find $(PREFIX) -type f -name "*.go")
GOOS=windows GOARCH=$* GOARM= CGO_ENABLED=0 \
$(GO) build \
-ldflags "-w -s $(COMMIT_FLAG) $(VERSION_FLAG)" \
-o $@ \
./cmd/gomplate

$(PREFIX)/bin/$(PKG_NAME)_%$(TARGETVARIANT)$(call extension,$(GOOS)): $(shell find $(PREFIX) -type f -name "*.go")
GOOS=$(shell echo $* | cut -f1 -d-) GOARCH=$(shell echo $* | cut -f2 -d- ) GOARM=$(GOARM) CGO_ENABLED=0 \
$(GO) build \
Expand Down

0 comments on commit ed380be

Please sign in to comment.