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.

49 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. # Delete the old dir
  19. echo "==> Removing old directory..."
  20. rm -rf build/pkg
  21. mkdir -p build/pkg
  22. # Do a hermetic build inside a Docker container.
  23. docker build -t tendermint/tendermint-builder scripts/tendermint-builder/
  24. docker run --rm -e "BUILD_TAGS=$BUILD_TAGS" -v "$(pwd)":/go/src/github.com/tendermint/tendermint tendermint/tendermint-builder ./scripts/dist_build.sh
  25. # Add "tendermint" and $VERSION prefix to package name.
  26. rm -rf ./build/dist
  27. mkdir -p ./build/dist
  28. for FILENAME in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type f); do
  29. FILENAME=$(basename "$FILENAME")
  30. cp "./build/pkg/${FILENAME}" "./build/dist/tendermint_${VERSION}_${FILENAME}"
  31. done
  32. # Make the checksums.
  33. pushd ./build/dist
  34. shasum -a256 ./* > "./tendermint_${VERSION}_SHA256SUMS"
  35. popd
  36. # Done
  37. echo
  38. echo "==> Results:"
  39. ls -hl ./build/dist
  40. exit 0