bump-release.sh 901 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash -eu
  2. #
  3. # $1 = version string (e.g. 0.8.0)
  4. VERSION="${1:?version must be set}"
  5. if [ "${VERSION:0:1}" == "v" ]; then
  6. echo "version tag shouldn't start with v" >> /dev/stderr
  7. exit 255
  8. fi
  9. ORIGIN="${ORIGIN:=upstream}"
  10. VERSIONTAG="v${VERSION}"
  11. TAGBR="v${VERSION}-tag"
  12. replace_version() {
  13. sed -i -e "s/const Version.*/const Version = \"$1\"/" version/version.go
  14. git commit -m "version: bump to v$1" version/version.go
  15. }
  16. # make sure we're up to date
  17. git pull --ff-only ${ORIGIN} master
  18. # tag it
  19. replace_version ${VERSION}
  20. git tag -a -m "${VERSIONTAG}" "${VERSIONTAG}"
  21. # bump ver to placeholder and push to origin
  22. replace_version "${VERSION}+git"
  23. git push "${ORIGIN}" master
  24. # push the tag
  25. git push "${ORIGIN}" "${VERSIONTAG}"
  26. echo
  27. echo "============================================================"
  28. echo "Tagged $VERSIONTAG in $ORIGIN"
  29. echo "Now run \"build-release.sh $VERSION\""
  30. echo