summaryrefslogtreecommitdiffhomepage
path: root/.circleci/release.sh
diff options
context:
space:
mode:
Diffstat (limited to '.circleci/release.sh')
-rwxr-xr-x.circleci/release.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/.circleci/release.sh b/.circleci/release.sh
new file mode 100755
index 0000000..a47f027
--- /dev/null
+++ b/.circleci/release.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+set -o nounset -o errexit -o pipefail
+
+TAG="$1"
+SUFFIX="linux-$(uname -m)"
+USER="jaspervdj"
+REPOSITORY="$(basename "$(pwd)")"
+BINARY="$REPOSITORY"
+
+echo "Tag: $TAG"
+echo "Suffix: $SUFFIX"
+
+if [[ -z "$TAG" ]]; then
+ echo "Not a tagged build, skipping release..."
+ exit 0
+fi
+
+GHR_VERSION="v0.5.4"
+
+# Install ghr
+wget --quiet \
+ "https://github.com/tcnksm/ghr/releases/download/${GHR_VERSION}/ghr_${GHR_VERSION}_linux_386.zip"
+unzip ghr_${GHR_VERSION}_linux_386.zip
+
+# Create tarball
+PACKAGE="$REPOSITORY-$TAG-$SUFFIX"
+mkdir -p "$PACKAGE"
+cp "$(which "$BINARY")" "$PACKAGE"
+cp "README.*" "$PACKAGE"
+tar -czf "$PACKAGE.tar.gz" "$PACKAGE"
+rm -r "$PACKAGE"
+
+# Actually upload
+./ghr -u "$USER" -r "$REPOSITORY" "$TAG" "$PACKAGE.tar.gz"