latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1)) version=${latest_tag#v} if [[ -z "$version" ]]; then echo "No Git tags found." exit 1 fi sed -i.bak "s/^version = \".*\"/version = \"$version\"/" Cargo.toml echo "Cargo version updated to $version"