1
1
mirror of https://github.com/Yvee1/hascard.git synced 2024-11-25 20:33:34 +03:00
hascard/.github/scripts/attach-binary.sh
Steven van den Broek 7155248257 Try to fix ghr again
2021-07-18 20:32:34 +02:00

27 lines
745 B
Bash
Executable File

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