Skip to content

Commit

Permalink
extra/bump_version: clean up a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHabets committed Feb 16, 2025
1 parent 3765ab6 commit 4d6326a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
25 changes: 17 additions & 8 deletions extra/bump_version.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
(
Expand All @@ -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

0 comments on commit 4d6326a

Please sign in to comment.