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

27 lines
745 B
Bash
Raw Normal View History

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-18 21:32:34 +03:00
ls $HOME/.local/bin/
echo $PATH
$HOME/.local/bin/ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
2021-07-16 21:02:35 +03:00
fi