commit 7c13b3a2e4e705bdb7fe47bf61ea0f063ea3f72c parent 8f436c120c2f3fdd8bba4e045b6853947a2b935e Author: Sean Enck <sean@ttypty.com> Date: Sat, 28 Jan 2023 17:14:24 -0500 cleaning up version script Diffstat:
| M | cmd/vers.txt | | | 4 | ++-- |
| M | scripts/version | | | 39 | ++++++++++++++------------------------- |
2 files changed, 16 insertions(+), 27 deletions(-)
diff --git a/cmd/vers.txt b/cmd/vers.txt @@ -1 +1 @@ -v23.01.02 -\ No newline at end of file +v23.01.03 +\ No newline at end of file diff --git a/scripts/version b/scripts/version @@ -1,37 +1,26 @@ #!/usr/bin/env sh -IS_CARGO="test -e Cargo.toml" - if [ ! -d .git ]; then - echo "not git controlled" - exit 0 + echo "not git controlled" + exit 0 fi _version() { - curr=v$(date +%g.%m.) - tag=$(git describe --tags --abbrev=0) - minor=00 - if echo "$tag" | grep -q "$curr*"; then - minor=$(echo "$tag" | cut -d '.' -f 3 | sed 's/^0//g') - minor=$((minor+1)) - if [ $minor -lt 10 ]; then - minor="0$minor" - fi - fi - vers="$curr$minor" - if $IS_CARGO; then - vers=$(echo "$vers" | sed 's/^v//g;s/\.0/./g') - sed -i 's/^version =.*/version = "'"$vers"'"/' Cargo.toml - else - printf "%s" "$vers" + curr=v$(date +%g.%m.) + tag=$(git describe --tags --abbrev=0) + minor=00 + if echo "$tag" | grep -q "$curr*"; then + minor=$(echo "$tag" | cut -d '.' -f 3 | sed 's/^0//g') + minor=$((minor+1)) + if [ $minor -lt 10 ]; then + minor="0$minor" fi + fi + vers="$curr$minor" + printf "%s" "$vers" } _main() { - if $IS_CARGO; then - _version - else - _version > cmd/vers.txt - fi + _version > cmd/vers.txt } _main