push-release 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. #
  3. # Create the official release
  4. #
  5. set -e
  6. set -o pipefail
  7. . script/release/utils.sh
  8. function usage() {
  9. >&2 cat << EOM
  10. Publish a release by building all artifacts and pushing them.
  11. This script requires that 'git config branch.${BRANCH}.release' is set to the
  12. release version for the release branch.
  13. EOM
  14. exit 1
  15. }
  16. BRANCH="$(git rev-parse --abbrev-ref HEAD)"
  17. VERSION="$(git config "branch.${BRANCH}.release")" || usage
  18. API=https://api.github.com/repos
  19. REPO=docker/compose
  20. [email protected]:$REPO
  21. # Check the build status is green
  22. sha=$(git rev-parse HEAD)
  23. url=$API/$REPO/statuses/$sha
  24. build_status=$(curl -s $url | jq -r '.[0].state')
  25. if [[ "$build_status" != "success" ]]; then
  26. >&2 echo "Build status is $build_status, but it should be success."
  27. exit -1
  28. fi
  29. # Build the binaries and sdists
  30. script/build-linux
  31. # TODO: build osx binary
  32. # script/prepare-osx
  33. # script/build-osx
  34. python setup.py sdist --formats=gztar,zip
  35. echo "Test those binaries! Exit the shell to continue."
  36. $SHELL
  37. echo "Tagging the release as $VERSION"
  38. git tag $VERSION
  39. git push $GITHUB_REPO $VERSION
  40. echo "Create a github release"
  41. # TODO: script more of this https://developer.github.com/v3/repos/releases/
  42. browser https://github.com/$REPO/releases/new
  43. echo "Uploading sdist to pypi"
  44. python setup.py sdist upload
  45. echo "Testing pip package"
  46. virtualenv venv-test
  47. source venv-test/bin/activate
  48. pip install docker-compose==$VERSION
  49. docker-compose version
  50. deactivate
  51. echo "Now publish the github release, and test the downloads."
  52. echo "Email [email protected] and [email protected] about the new release.