2021-07-16 21:02:35 +03:00
|
|
|
set -o errexit -o verbose
|
|
|
|
|
2021-07-16 23:23:47 +03:00
|
|
|
if test ! "$RELEASE_VERSION"
|
2021-07-16 21:02:35 +03:00
|
|
|
then
|
|
|
|
echo 'This is not a release build.'
|
|
|
|
else
|
2021-07-16 23:23:47 +03:00
|
|
|
echo "Attaching binary for $RUNNER_OS to $RELEASE_VERSION..."
|
2021-07-17 12:25:31 +03:00
|
|
|
if [ "$RUNNER_OS" = "Linux" ]
|
|
|
|
then
|
|
|
|
ARCH="linux"
|
|
|
|
else
|
|
|
|
ARCH="osx"
|
|
|
|
fi
|
2021-07-16 21:02:35 +03:00
|
|
|
OWNER="$(echo "$GITHUB_REPOSITORY" | cut -f1 -d/)"
|
|
|
|
REPO="$(echo "$GITHUB_REPOSITORY" | cut -f2 -d/)"
|
|
|
|
BIN="$(stack path --local-install-root)/bin/$REPO"
|
2021-07-17 12:25:31 +03:00
|
|
|
BUNDLE_NAME="$REPO-$RELEASE_VERSION-$ARCH.tar.gz"
|
2021-07-16 21:02:35 +03:00
|
|
|
cp "$BIN" "./$REPO"
|
|
|
|
chmod +x "./$REPO"
|
|
|
|
tar -czf "$BUNDLE_NAME" "$REPO"
|
|
|
|
echo "SHA256:"
|
|
|
|
shasum -a 256 "$BUNDLE_NAME"
|
2021-07-17 12:25:31 +03:00
|
|
|
ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
|
2021-07-16 21:02:35 +03:00
|
|
|
fi
|