diff --git a/README.md b/README.md index cf0517c..f3a04fc 100644 --- a/README.md +++ b/README.md @@ -25,4 +25,4 @@ A library for digital signals processing in the spirit of GNU Radio. * A clear strategy for optional output streams. * SymbolSync block at least have the right API. * Example AX.25 KISS modem written. -* Add cargo-semver-checks to pre-commit or bump-version? +* Merge the WIP `more-input` branch. diff --git a/extra/bump_version.sh b/extra/bump_version.sh index 7dc1bf1..b4205f5 100755 --- a/extra/bump_version.sh +++ b/extra/bump_version.sh @@ -1,4 +1,10 @@ #!/usr/bin/env bash +# +# Automate bumping version and publishing. +# +# Running without args bumps the patch level version. +# Alternatively, provide the new version as the first arg. +# set -ueo pipefail # Check that client is clean. @@ -7,18 +13,17 @@ set -ueo pipefail exit 1 } +# Provide the new version. CURRENT="$(awk '/^version/ {print $3}' Cargo.toml | head -1 | sed 's/"//g')" -if [[ "${1:-}" = "" ]]; then - NEW="$(echo $CURRENT | awk -F. '{print $1 "." $2 "." $3+1}')" -else - NEW="$1" -fi +AUTO_NEW_VERSION="$(echo $CURRENT | awk -F. '{print $1 "." $2 "." $3+1}')" +NEW="${1:-$AUTO_NEW_VERSION}" echo "Current: '$CURRENT', New: '$NEW'" sed -i "s/^version = \"${CURRENT?}\"/version = \"${NEW?}\"/" Cargo.toml sed -i -r 's/^(rustradio_macros.*version = ")[0-9.]+(".*)/\1'"${NEW}"'\2/' Cargo.toml sed -i "s/^version = \"${CURRENT?}\"/version = \"${NEW?}\"/" rustradio_macros/Cargo.toml # At least one of these should update Cargo.locks, I hope. +# This of course in addition to running the tests one more time. cargo build cargo test ( @@ -27,12 +32,16 @@ cargo test cargo test ) -echo "Run E2E tests" +echo "=== Run E2E tests ===" cargo test -- --ignored -git commit -a -m"Bump version to ${NEW?}" +echo "=== Run semver checks ===" cargo semver-checks + +echo "=== Commit, tag, and push ===" +git commit -a -m"Bump version to ${NEW?}" git tag "v${NEW?}" git push git push --tags -(cd rustradio_macros/ && cargo publish) && cargo publish +(cd rustradio_macros/ && cargo publish) +cargo publish