Skip to content

Commit

Permalink
[KEYCLOAK-8487] Provide gatekeeper binaries for Linux, Windows and OSx
Browse files Browse the repository at this point in the history
  - Build only for amd64
  - Replaces gzip by tar and generate each file based on the OS
  - Inclusion of sha1 files and set-version.sh script
  • Loading branch information
Bruno Oliveira da Silva authored and stianst committed Oct 10, 2018
1 parent 4248e56 commit 688850a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ DEPS=$(shell go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
PACKAGES=$(shell go list ./...)
LFLAGS ?= -X main.gitsha=${GIT_SHA} -X main.compiled=${BUILD_TIME}
VETARGS ?= -asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
PLATFORMS=darwin linux windows
ARCHITECTURES=amd64

.PHONY: test authors changelog build docker static release lint cover vet glide-install

Expand All @@ -25,6 +27,14 @@ build: golang
@mkdir -p bin
go build -ldflags "${LFLAGS}" -o bin/${NAME}

release: clean golang deps
@mkdir -p release
$(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES), $(shell [ $(GOOS) = "windows" ] && EXT=".exe"; env GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 \
go build -a -tags netgo -ldflags "-w ${LFLAGS}" -o bin/${NAME}$$EXT; \
tar -czvf release/${NAME}-$(GOOS)-$(GOARCH).tar.gz -C bin/ ${NAME}$$EXT >/dev/null; \
sha1sum release/${NAME}-$(GOOS)-$(GOARCH).tar.gz | cut -d " " -f1 > release/${NAME}-$(GOOS)-$(GOARCH).tar.gz.sha1 )))

static: golang deps
@echo "--> Compiling the static binary"
@mkdir -p bin
Expand Down Expand Up @@ -66,14 +76,9 @@ certs:
-profile=server \
tests/proxy-csr.json | cfssljson -bare tests/proxy

release: static
mkdir -p release
gzip -c bin/${NAME} > release/${NAME}_${VERSION}_linux_${HARDWARE}.gz
rm -f release/${NAME}

clean:
rm -rf ./bin 2>/dev/null
rm -rf ./release 2>/dev/null
rm -rf ./bin/* 2>/dev/null
rm -rf ./release/* 2>/dev/null

authors:
@echo "--> Updating the AUTHORS"
Expand Down
6 changes: 6 additions & 0 deletions set-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -e

NEW_VERSION=$1

CURRENT=`awk '/release.*=/ { print $3 }' doc.go | sed 's/"//g'`
sed -i "s/$CURRENT/$NEW_VERSION/g" doc.go

0 comments on commit 688850a

Please sign in to comment.