mirror of
https://github.com/Yvee1/hascard.git
synced 2024-10-05 19:49:16 +03:00
Add attach-binary script
This commit is contained in:
parent
65b8d0f2bd
commit
91f7df3bea
@ -18,4 +18,4 @@ script:
|
||||
- stack setup
|
||||
- stack build
|
||||
after_success:
|
||||
- echo "success"
|
||||
- sh travis/attach-binary.sh
|
22
travis/attach-binary.sh
Normal file
22
travis/attach-binary.sh
Normal file
@ -0,0 +1,22 @@
|
||||
set -o errexit -o verbose
|
||||
|
||||
if test ! "$TRAVIS_TAG"
|
||||
then
|
||||
echo 'This is not a release build.'
|
||||
elif test ! "$GITHUB_TOKEN"
|
||||
then
|
||||
echo 'The GITHUB_TOKEN environment variable is not set!'
|
||||
exit 1
|
||||
else
|
||||
echo "Attaching binary for $TRAVIS_OS_NAME to $TRAVIS_TAG..."
|
||||
OWNER="$(echo "$TRAVIS_REPO_SLUG" | cut -f1 -d/)"
|
||||
REPO="$(echo "$TRAVIS_REPO_SLUG" | cut -f2 -d/)"
|
||||
BIN="$(stack path --local-install-root)/bin/$REPO"
|
||||
BUNDLE_NAME="$REPO-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz"
|
||||
cp "$BIN" "./$REPO"
|
||||
chmod +x "./$REPO"
|
||||
tar -czf "$BUNDLE_NAME" "$REPO"
|
||||
echo "SHA256:"
|
||||
shasum -a 256 "$BUNDLE_NAME"
|
||||
ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user