Skip to content

Commit

Permalink
Add release script
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Kassar committed Mar 24, 2017
1 parent 12216ac commit 60354b1
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.dapper
.github-release
bin/
dist/
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TARGETS := $(shell ls scripts | grep -vE 'clean|help')
TARGETS := $(shell ls scripts | grep -vE 'clean|help|release')

.dapper:
@echo Downloading dapper
Expand All @@ -7,6 +7,13 @@ TARGETS := $(shell ls scripts | grep -vE 'clean|help')
@./.dapper.tmp -v
@mv .dapper.tmp .dapper

.github-release:
@echo Downloading github-release
@curl -sL https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2 | tar xjO > .github-release.tmp
@@chmod +x .github-release.tmp
@./.github-release.tmp -v
@mv .github-release.tmp .github-release

$(TARGETS): .dapper
./.dapper $@

Expand All @@ -16,6 +23,9 @@ clean:
help:
@./scripts/help

release: .github-release
./scripts/release

.DEFAULT_GOAL := ci

.PHONY: .dapper $(TARGETS) clean help
.PHONY: .dapper $(TARGETS) clean help release
26 changes: 26 additions & 0 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

GITHUB_USER="kassisol"
REPO_NAME="hbm"

function upload_file() {
local directory=$1

for file in $(ls ${directory}/); do
./.github-release upload --user ${GITHUB_USER} --repo ${REPO_NAME} --tag ${VERSION} --file ${directory}/${file} --name ${file}
done
}

source $(dirname $0)/version

VERSION_OK=`echo ${VERSION} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$" | wc -l`
if [ $VERSION_OK -eq 0 ]; then
echo "Cannot release the version ${VERSION}"
exit 100
fi

./.github-release release --user ${GITHUB_USER} --repo ${REPO_NAME} --tag ${VERSION} --pre-release --draft

upload_file "bin"
upload_file "dist"

0 comments on commit 60354b1

Please sign in to comment.