You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

  1. #!/usr/bin/env bash
  2. set -e
  3. # Get the version from the environment, or try to figure it out.
  4. if [ -z $VERSION ]; then
  5. VERSION=$(awk -F\" '/Version =/ { print $2; exit }' < version/version.go)
  6. fi
  7. if [ -z "$VERSION" ]; then
  8. echo "Please specify a version."
  9. exit 1
  10. fi
  11. echo "==> Building version $VERSION..."
  12. # Get the parent directory of where this script is.
  13. SOURCE="${BASH_SOURCE[0]}"
  14. while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
  15. DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
  16. # Change into that dir because we expect that.
  17. cd "$DIR"
  18. # Generate the tag.
  19. if [ -z "$NOTAG" ]; then
  20. echo "==> Tagging..."
  21. git commit --allow-empty -a -m "Release v$VERSION"
  22. git tag -a -m "Version $VERSION" "v${VERSION}" master
  23. fi
  24. # Do a hermetic build inside a Docker container.
  25. docker build -t tendermint/tendermint-builder scripts/tendermint-builder/
  26. docker run --rm -e "BUILD_TAGS=$BUILD_TAGS" -v "$(pwd)":/go/src/github.com/tendermint/tendermint tendermint/tendermint-builder ./scripts/dist_build.sh
  27. # Add "tendermint" and $VERSION prefix to package name.
  28. rm -rf ./build/dist
  29. mkdir -p ./build/dist
  30. for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do
  31. FILENAME=$(basename "$FILENAME")
  32. cp "./build/pkg/${FILENAME}" "./build/dist/tendermint_${VERSION}_${FILENAME}"
  33. done
  34. # Make the checksums.
  35. pushd ./build/dist
  36. shasum -a256 ./* > "./tendermint_${VERSION}_SHA256SUMS"
  37. popd
  38. # Done
  39. echo
  40. echo "==> Results:"
  41. ls -hl ./build/dist
  42. exit 0