1
1
mirror of https://github.com/Yvee1/hascard.git synced 2024-11-29 09:34:20 +03:00
hascard/.github/scripts/attach-binary.sh

19 lines
608 B
Bash
Raw Normal View History

2021-07-16 21:02:35 +03:00
set -o errexit -o verbose
if test ! "$GITHUB_REF"
then
echo 'This is not a release build.'
else
echo "Attaching binary for $RUNNER_OS to $GITHUB_REF..."
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-$GITHUB_REF-$RUNNER_OS.tar.gz"
cp "$BIN" "./$REPO"
chmod +x "./$REPO"
tar -czf "$BUNDLE_NAME" "$REPO"
echo "SHA256:"
shasum -a 256 "$BUNDLE_NAME"
2021-07-16 21:48:49 +03:00
ghr -t "${{ secrets.GITHUB_TOKEN }}" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
2021-07-16 21:02:35 +03:00
fi