Allen George | f9f037b | 2018-12-27 13:56:21 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o errexit |
| 4 | set -o pipefail |
| 5 | set -o nounset |
| 6 | |
| 7 | if ! [[ $# -eq 1 && $1 =~ ^[0-9](\.[0-9][0-9]*){2}$ ]]; then |
| 8 | (>&2 echo "Usage: ./publish-crate.sh [THRIFT_RELEASE_VERSION] ") |
| 9 | (>&2 echo " THRIFT_RELEASE_VERSION is in semantic versioning format, i.e. #.##.##") |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
| 13 | THRIFT_RELEASE_VERSION=${1:-} |
| 14 | |
| 15 | echo "Updating Cargo.toml to ${THRIFT_RELEASE_VERSION}" |
| 16 | sed -i.old -e "s/^version = .*$/version = \"${THRIFT_RELEASE_VERSION}\"/g" Cargo.toml |
| 17 | rm Cargo.toml.old |
| 18 | |
| 19 | echo "Committing updated Cargo.toml" |
| 20 | git add Cargo.toml |
| 21 | git commit -m "Update thrift crate version to ${THRIFT_RELEASE_VERSION}" -m "Client: rs" |
| 22 | |
| 23 | echo "Packaging and releasing rust thrift crate with version ${THRIFT_RELEASE_VERSION}" |
| 24 | cargo clean |
| 25 | cargo package |
| 26 | cargo publish |