working release builder

This commit is contained in:
Ad van der Veer
2015-12-25 13:41:19 +01:00
parent 6b532ab48f
commit c93ab5946f
3 changed files with 40 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
FROM ubuntu:14.04
MAINTAINER Microfactory <info@microfactory.io>
RUN apt-get update; apt-get install -y curl unzip;
RUN apt-get update; apt-get install -y curl unzip git ;
# install golang runtime
RUN curl -L https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz > /tmp/golang.tar.gz; tar -C /usr/local -xzf /tmp/golang.tar.gz; rm /tmp/golang.tar.gz

3
Dockerfile.release Normal file
View File

@@ -0,0 +1,3 @@
FROM microfactory/zero
RUN go get github.com/aktau/github-release
ENTRYPOINT ["./make.sh", "do-release"]

38
make.sh
View File

@@ -3,11 +3,24 @@ set -e
function print_help {
printf "Available Commands:\n";
printf " test\n"
printf " release\n"
printf " test\n"
}
#publish a new release to github
function run_release {
git tag v`cat VERSION` || true
git push --tags
: "${GITHUB_TOKEN:?GITHUB_TOKEN environment variable needs to be set in order to test}"
run_build_container
docker build -t microfactory/zero:linux-release -f Dockerfile.release .
docker run -it --rm -e "GITHUB_TOKEN=$GITHUB_TOKEN" microfactory/zero:linux-release
}
function run_build_container {
docker build -t microfactory/zero:`cat VERSION` .
docker tag -f microfactory/zero:`cat VERSION` microfactory/zero:latest
}
# run a Linux test environment
@@ -22,7 +35,28 @@ function run_test {
microfactory/zero:`cat VERSION` -start-daemon -name=test-member $ZT_NET $ZT_TOKEN
}
# This is expected to be run INSIDE a container
function do_release {
: "${GITHUB_TOKEN:?GITHUB_TOKEN environment variable needs to be set in order to test}"
printf "Drafing release...\n"
github-release release \
--user microfactory \
--repo zero \
--tag v`cat VERSION` \
--pre-release
printf "Uploading...\n"
github-release upload \
--user microfactory \
--repo zero \
--tag v`cat VERSION` \
--name zero \
--file /usr/local/bin/zero
}
case $1 in
"test") run_test ;;
"do-release") do_release ;;
"release") run_release ;;
"test") run_test ;;
*) print_help ;;
esac