From 15600ceac52acfbed3530bb89485198b9ea650e5 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Sun, 16 Feb 2025 10:31:00 +0100 Subject: [PATCH] feat: enhance release script to support upstream push and improve error handling --- release.sh | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index 3c5011f..e611a72 100644 --- a/release.sh +++ b/release.sh @@ -16,7 +16,14 @@ if [ -n "$(git status --porcelain)" ]; then exit 1 fi -# Create and push tag +# Push to origin (local git repo) +echo "Pushing to origin..." +git push origin +if [ $? -ne 0 ]; then + echo "Error: Failed to push to origin" + exit 1 +fi + git tag "v$VERSION" if [ $? -ne 0 ]; then echo "Error: Failed to create tag v$VERSION" @@ -25,10 +32,29 @@ fi git push origin "v$VERSION" if [ $? -ne 0 ]; then - echo "Error: Failed to push tag v$VERSION" + echo "Error: Failed to push tag v$VERSION to origin" git tag -d "v$VERSION" exit 1 fi +# Ask for upstream push +read -p "Do you want to push to GitHub (upstream)? (y/n) " -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "Pushing to upstream (GitHub)..." + git push upstream + if [ $? -ne 0 ]; then + echo "Error: Failed to push to upstream" + exit 1 + fi + + git push upstream "v$VERSION" + if [ $? -ne 0 ]; then + echo "Error: Failed to push tag v$VERSION to upstream" + exit 1 + fi + echo "Successfully pushed to GitHub" +fi + echo "Successfully created and pushed tag v$VERSION" -echo "GitHub Actions workflow will now create the release" \ No newline at end of file +echo "All operations completed" \ No newline at end of file