Skip to content

Commit dd83933

Browse files
committed
Add release upload script
1 parent 02c93a9 commit dd83933

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ jobs:
3232
paths:
3333
- '~/.cabal'
3434
- '~/.ghc'
35+
- run:
36+
name: 'Upload release'
37+
command: '.circleci/release.sh "$CIRCLE_TAG"'

.circleci/release.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
set -o nounset -o errexit -o pipefail
3+
4+
TAG="$1"
5+
SUFFIX="linux-$(uname -m)"
6+
USER="jaspervdj"
7+
REPOSITORY="$(basename "$(pwd)")"
8+
BINARY="$REPOSITORY"
9+
10+
echo "Tag: $TAG"
11+
echo "Suffix: $SUFFIX"
12+
13+
if [[ -z "$TAG" ]]; then
14+
echo "Not a tagged build, skipping release..."
15+
exit 0
16+
fi
17+
18+
GHR_VERSION="v0.5.4"
19+
20+
# Install ghr
21+
wget --quiet \
22+
"https://github.com/tcnksm/ghr/releases/download/${GHR_VERSION}/ghr_${GHR_VERSION}_linux_386.zip"
23+
unzip ghr_${GHR_VERSION}_linux_386.zip
24+
25+
# Create tarball
26+
PACKAGE="$REPOSITORY-$TAG-$SUFFIX"
27+
mkdir -p "$PACKAGE"
28+
cp "$(which "$BINARY")" "$PACKAGE"
29+
cp "README.*" "$PACKAGE"
30+
tar -czf "$PACKAGE.tar.gz" "$PACKAGE"
31+
rm -r "$PACKAGE"
32+
33+
# Actually upload
34+
./ghr -u "$USER" -r "$REPOSITORY" "$TAG" "$PACKAGE.tar.gz"

0 commit comments

Comments
 (0)