add set_versions.sh

This commit is contained in:
Brad Warren
2026-06-12 11:03:48 -07:00
committed by Will Greenberg
parent 772dac681e
commit ce821b825f
2 changed files with 33 additions and 2 deletions
+1 -2
View File
@@ -75,8 +75,7 @@ You can read our [full policy](https://www.eff.org/about/opportunities/volunteer
This one is for maintainers of Rayhunter.
1. Make a PR changing the versions in `Cargo.toml` and other files.
This could be automated better but right now it's manual. You can do this easily with sed:
`sed -i "" -E 's/x.x.x/y.y.y/g' */Cargo.toml installer-gui/src-tauri/Cargo.toml`
This can be done by running `scripts/set-versions.sh VERSION_NUM`.
2. Merge the PR, make a tag, and push the tag to GitHub. Pushing the tag should
trigger the [release workflow](https://github.com/EFForg/rayhunter/actions/workflows/release.yml).
+32
View File
@@ -0,0 +1,32 @@
#!/bin/bash
# Sets Rayhunter package versions in preparation for a release.
#
# Usage: ./scripts/set-versions.sh VERSION_NUM
# Example: ./scripts/set-versions.sh 0.12.3
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_DIR"
if [ -z "$1" ]; then
echo "Error: Missing required version number argument."
exit 1
fi
SED_COMMAND="s/^version = \".*\"/version = \"$1\"/"
TOML_FILES=(*/Cargo.toml installer-gui/src-tauri/Cargo.toml)
echo "Updating Cargo.toml files"
if sed --version > /dev/null 2>&1; then
# we have GNU sed
sed -i -E "$SED_COMMAND" "${TOML_FILES[@]}"
else
# we have macOS/BSD sed
sed -i "" -E "$SED_COMMAND" "${TOML_FILES[@]}"
fi
echo "Updating Cargo.lock"
cargo update --workspace