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.

52 lines
1.4 KiB

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