Add error handling for git operations

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Edward Firmo
2024-12-21 10:29:46 +01:00
committed by GitHub
parent 23436428a4
commit 04ca752c3b

View File

@@ -43,6 +43,15 @@ echo "$NEW_VERSION" > "$VERSION_FILE"
echo "version: $NEW_VERSION" > "$VERSION_YAML_FILE"
# Commit and tag
git add "$VERSION_FILE" "$VERSION_YAML_FILE"
git commit -m "Bump version to $NEW_VERSION"
git tag "v$NEW_VERSION"
if ! git add "$VERSION_FILE" "$VERSION_YAML_FILE"; then
echo "Error: Failed to stage version files"
exit 1
fi
if ! git commit -m "Bump version to $NEW_VERSION"; then
echo "Error: Failed to commit version bump"
exit 1
fi
if ! git tag "v$NEW_VERSION"; then
echo "Error: Failed to create version tag"
exit 1
fi