fn: automatic release (#330)

* fn: automatic release

* fn: fix script call
This commit is contained in:
C Cirello
2016-11-22 17:37:11 +01:00
committed by GitHub
parent 0d38b59ee9
commit 243fbe45d2
3 changed files with 21 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ vendor:
test:
go test -v $(shell glide nv)
release: docker
release:
GOOS=linux go build -o fn_linux
GOOS=darwin go build -o fn_mac
GOOS=windows go build -o fn.exe

17
fn/release.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -ex
make release
version=$1
url='https://api.github.com/repos/iron-io/functions/releases'
output=$(curl -s -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY -d "{\"tag_name\": \"$version\", \"name\": \"$version\"}" $url)
upload_url=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["upload_url"]' | sed -E "s/\{.*//")
html_url=$(echo "$output" | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["html_url"]')
curl --data-binary "@fn_linux" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn_linux >/dev/null
curl --data-binary "@fn_mac" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn_mac >/dev/null
curl --data-binary "@fn.exe" -H "Content-Type: application/octet-stream" -u $GH_DEPLOY_USER:$GH_DEPLOY_KEY $upload_url\?name\=fn.exe >/dev/null

View File

@@ -28,3 +28,6 @@ docker tag $user/$service:$tag $user/$service:$version
docker push $user/$service:$version
docker push $user/$service:$tag
cd fn
./release.sh $version