2
0
mirror of https://github.com/namecoin/ncdns synced 2024-11-16 00:13:01 +00:00
ncdns/.travis/after_success
2019-10-04 03:58:12 +00:00

45 lines
1.2 KiB
Bash

#!/bin/bash
# Only upload version tags.
if ! [[ "$TRAVIS_TAG" =~ ^v[0-9] ]]; then
echo Skipping release upload because this build is not for a release tag.
return 0
fi
if [ "${NO_NAMECOIN_TLS}" != "0" ]; then
echo "Skipping release upload because TLS is disabled."
return 0
fi
if [ -z "$GITHUB_TOKEN" ]; then
echo "Don't appear to have GitHub token, cannot continue."
return 0
fi
if [[ "${TRAVIS_GO_VERSION}." != "${RELEASE_GO_VERSION}."* ]]; then
echo "Travis Go version ($TRAVIS_GO_VERSION) is not the releasing version ($RELEASE_GO_VERSION), not releasing."
return 0
fi
# Make archives.
echo Archiving releases...
SRC_DIR="$(pwd)"
cd "$GOPATH/releasing/idist"
for x in *; do
echo "$x"
mkdir -p "$x/doc"
cp "$GOPATH/src/github.com/$TRAVIS_REPO_SLUG/.travis/dist-readme.md" "$x"/README.md || \
cp "$GOPATH/src/github.com/$TRAVIS_REPO_SLUG/README.md" "$x/" || true
cp "$GOPATH/src/github.com/$TRAVIS_REPO_SLUG/_doc/"* "$x/doc/"
tar -zcf "../dist/$(basename "$x").tar.gz" "$x"
done
# Must be in the right directory when calling ghr.
cd "$SRC_DIR"
echo Uploading releases...
TRAVIS_REPO_OWNER="$(echo "$TRAVIS_REPO_SLUG" | sed 's#/.*$##g')"
travis_retry ghr -u "$TRAVIS_REPO_OWNER" "$TRAVIS_TAG" "$GOPATH/releasing/dist/"
echo Done