diff options
author | Jasper Van der Jeugt <m@jaspervdj.be> | 2017-12-26 14:41:30 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <m@jaspervdj.be> | 2017-12-26 14:41:39 +0100 |
commit | dd83933d5b4a48cfbb53f51a5af590baf48fc8c7 (patch) | |
tree | b7b7a4e89530449b35c312b7738fde5858d11077 | |
parent | 02c93a9c34ff9bed0b536f5f7a92c6f802d54480 (diff) | |
download | stylish-haskell-dd83933d5b4a48cfbb53f51a5af590baf48fc8c7.tar.gz |
Add release upload script
-rw-r--r-- | .circleci/config.yml | 3 | ||||
-rwxr-xr-x | .circleci/release.sh | 34 |
2 files changed, 37 insertions, 0 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 47e30b8..3845c0e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,3 +32,6 @@ jobs: paths: - '~/.cabal' - '~/.ghc' + - run: + name: 'Upload release' + command: '.circleci/release.sh "$CIRCLE_TAG"' 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" |