File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ set -euo pipefail
66# Usage: ./build.sh — optimized release (LTO + strip)
77# ./build.sh fast — no LTO, faster compile
88
9+ # Derive version from latest git tag, fall back to Cargo.toml
10+ if command -v git & > /dev/null && git rev-parse --git-dir > /dev/null 2>&1 ; then
11+ TAG_VERSION=$( git describe --tags --abbrev=0 2> /dev/null | sed ' s/^v//' )
12+ fi
13+ CARGOTOML_VERSION=$( grep ' ^version' Cargo.toml | head -1 | sed ' s/.*"\(.*\)".*/\1/' )
14+ if [ -n " ${TAG_VERSION:- } " ] && [ " $TAG_VERSION " != " $CARGOTOML_VERSION " ]; then
15+ sed -i " s/^version = \" .*\" /version = \" $TAG_VERSION \" /" Cargo.toml
16+ echo " Cargo.toml version updated to $TAG_VERSION "
17+ fi
918VERSION=$( grep ' ^version' Cargo.toml | head -1 | sed ' s/.*"\(.*\)".*/\1/' )
1019echo " === NotAlterra v${VERSION} ==="
1120
@@ -58,4 +67,6 @@ echo "=== Done ==="
5867# Remind user to sign and push to trigger CI release
5968echo " "
6069echo " --- Next: sign & push for CI release ---"
61- echo " git commit --amend --no-edit --gpg-sign && git push -f origin master"
70+ echo " git add Cargo.toml && git commit --no-gpg-sign -m \" Bump to v${VERSION} \" "
71+ echo " git tag -s \" v${VERSION} \" -m \" v${VERSION} \" "
72+ echo " git push origin master && git push origin \" v${VERSION} \" "
You can’t perform that action at this time.
0 commit comments