🔨 Retoques en scripts de liberación de versiones

This commit is contained in:
Manuel Cillero 2026-05-03 12:16:45 +02:00
parent 2da8bd6558
commit 516607d9c0
2 changed files with 10 additions and 2 deletions

View file

@ -130,8 +130,9 @@ if [[ -n "$(git status --porcelain -- "$CHANGELOG_FILE")" ]]; then
git add "$CHANGELOG_FILE"
echo "Staged $CHANGELOG_FILE for commit"
else
echo "Changes detected in '$CHANGELOG_FILE', but not staged (no --stage flag)"
echo "Changes not staged (no --stage flag)"
fi
else
echo "No changes in '$CHANGELOG_FILE', skipping staging"
echo "No changes in '$CHANGELOG_FILE', aborting release."
exit 1
fi

View file

@ -25,6 +25,11 @@ if [[ ! "$LEVEL" =~ ^(patch|minor|major)$ ]]; then
echo "Error: invalid level '$LEVEL'. Use: patch, minor, or major"
exit 1
fi
if [[ -n "$(git status --porcelain)" ]]; then
echo "Error: uncommitted changes detected. Please commit or stash before releasing." >&2
git status --short >&2
exit 1
fi
# Dependencias
command -v cargo-release >/dev/null || {
@ -41,6 +46,8 @@ cd "$(dirname "$0")/.." || exit 1
if [[ "$EXECUTE" != "--execute" ]]; then
echo "Running dry-run (default mode). Add --execute to publish"
cargo release --config "$CONFIG" --package "$CRATE" "$LEVEL"
# El hook puede haber añadido el CHANGELOG al staged; lo revertimos
git diff --cached --name-only | grep 'CHANGELOG.md' | xargs -r git reset --
else
echo "Releasing $CRATE ($LEVEL)..."
cargo release --config "$CONFIG" --package "$CRATE" "$LEVEL" --execute