11SHELL := /bin/bash
22
3+ GITHUB_OWNER = moia-dev
4+ GITHUB_REPOSITORY = k8s-oidc-helper
5+
36# The destination for binaries
47BUILD_DIR = build
58
@@ -8,7 +11,7 @@ TARGET := $(shell echo $${PWD\#\#*/})
811.DEFAULT_GOAL : $(TARGET )
912
1013# These will be provided to the target
11- VERSION :=0.9.0-rc1
14+ VERSION :=0.2.0
1215BUILD := ` git rev-parse HEAD `
1316
1417# Use linker flags to provide version/build settings to the target
@@ -24,6 +27,14 @@ all: check compile
2427$(TARGET ) : $(SRC )
2528 @go build $(LDFLAGS ) -o $(TARGET )
2629
30+ .PHONY : release
31+ release : guard-VERSION guard-GITHUB_TOKEN compile
32+ github-release info --user $(GITHUB_OWNER ) --repo $(GITHUB_REPOSITORY )
33+ github-release release --user $(GITHUB_OWNER ) --repo $(GITHUB_REPOSITORY ) --tag v$(VERSION ) --name v$(VERSION )
34+ for f in build/linux/* ; do github-release upload --user $( GITHUB_OWNER) --repo $( GITHUB_REPOSITORY) --tag v$( VERSION) --name linux/` basename $$ {f}` --file $$ {f}; done
35+ for f in build/darwin/* ; do github-release upload --user $( GITHUB_OWNER) --repo $( GITHUB_REPOSITORY) --tag v$( VERSION) --name darwin/` basename $$ {f}` --file $$ {f}; done
36+ github-release edit --user $(GITHUB_OWNER ) --repo $(GITHUB_REPOSITORY ) --tag v$(VERSION ) --name v$(VERSION ) --description v$(VERSION )
37+
2738compile : check goxcompile
2839
2940goxcompile : export CGO_ENABLED=0
@@ -58,4 +69,10 @@ dependencies:
5869 go get github.com/mitchellh/gox
5970 go get github.com/jstemmer/go-junit-report
6071 go get github.com/golang/lint/golint
61- git submodule update --init --recursive
72+ git submodule update --init --recursive
73+
74+ guard-% :
75+ @ if [ " ${${* } } " = " " ]; then \
76+ echo "Environment variable $* not set"; \
77+ exit 1; \
78+ fi
0 commit comments