2
0
mirror of https://github.com/namecoin/ncdns synced 2024-11-13 13:10:33 +00:00
ncdns/.travis/after_success
Hugo Landau 446094224e
Fix release builds when multlple Go version builds are used
©! I, Hugo Landau <hlandau@devever.net>, hereby licence these changes under the
©! licence with SHA256 hash
©! fd80a26fbb3f644af1fa994134446702932968519797227e07a1368dea80f0bc.
2017-08-18 17:54:11 +01:00

40 lines
1.1 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 [ -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