From 6dd37766912de3ac9dd51b96c10ace60662de458 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 12 Jan 2016 23:40:57 +0100 Subject: imported vantiy 0.1.1 and updated debian package actually build from source --- Makefile | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7d6197d..9cf51a6 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,38 @@ -VERSION := 0.1.1 -DEBARCHS := amd64 i386 armhf -EXECUTEABLES := $(DEBARCHS:%=vanity.%) +GOX_OSARCH ?= "darwin/amd64 linux/amd64 linux/arm freebsd/386 freebsd/amd64 linux/386 windows/386" +GOX_OUTPUT_DIR ?= bin +GH_ACCESS_TOKEN ?= Missing access token. +MESSAGE ?= Latest release. -all: $(EXECUTEABLES) +all: clean + @mkdir -p $(GOX_OUTPUT_DIR) && \ + gox -osarch=$(GOX_OSARCH) -output "$(GOX_OUTPUT_DIR)/{{.Dir}}_{{.OS}}_{{.Arch}}" && \ + gzip bin/vanity_darwin_* && \ + gzip bin/vanity_freebsd_* && \ + gzip bin/vanity_linux_* && \ + zip -r bin/vanity_windows_386.zip bin/vanity_windows_386.exe -vanity.%: vanity_linux_%.gz - cat $< | gunzip > $@ +require-version: + @if [[ -z "$$VERSION" ]]; then echo "Missing \$$VERSION"; exit 1; fi -vanity_linux_%.gz: - wget -nc "https://github.com/xiam/vanity/releases/download/v$(VERSION)/$(shell echo $@ | sed s/i386/386/ | sed s/armhf/arm/)" -O $@ +release: require-version + @RESP=$$(curl --silent --data '{ \ + "tag_name": "v$(VERSION)", \ + "name": "v$(VERSION)", \ + "body": "$(MESSAGE)", \ + "target_commitish": "$(git rev-parse --abbrev-ref HEAD)", \ + "draft": false, \ + "prerelease": false \ + }' "https://api.github.com/repos/xiam/vanity/releases?access_token=$(GH_ACCESS_TOKEN)") && \ + \ + UPLOAD_URL_TEMPLATE=$$(echo $$RESP | python -mjson.tool | grep upload_url | awk '{print $$2}' | sed s/,$$//g | sed s/'"'//g) && \ + if [[ -z "$$UPLOAD_URL_TEMPLATE" ]]; then echo $$RESP; exit 1; fi && \ + \ + for ASSET in $$(ls -1 bin/); do \ + UPLOAD_URL=$$(echo $$UPLOAD_URL_TEMPLATE | sed s/"{?name,label}"/"?access_token=$(GH_ACCESS_TOKEN)\&name=$$ASSET"/g) && \ + MIME_TYPE=$$(file --mime-type bin/$$ASSET | awk '{print $$2}') && \ + curl --silent -H "Content-Type: $$MIME_TYPE" --data-binary @bin/$$ASSET $$UPLOAD_URL > /dev/null && \ + echo "-> $$ASSET OK." \ + ; done clean: - rm -f vanity.* - rm -f vanity_linux_*.gz + @rm -rf $(GOX_OUTPUT_DIR) -- cgit v1.2.3