Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed increment version deleting its current branch #1315

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions github_increment_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ def modify_rest_manager(file_contents: str, element: ast.Constant, new_version_t
# GET REPOSITORY REFERENCES
print(f"[4/8] Retrieving Tribler:py-ipv8 and {username}:py-ipv8.")

# branchname or "HEAD"
original_branch = subprocess.check_output("git rev-parse --abbrev-ref HEAD", encoding="utf-8").strip()
if original_branch == "HEAD":
# HEAD, origin/main, origin/HEAD
detached_details = subprocess.check_output("git show -s --pretty=%D HEAD", encoding="utf-8")
original_branch = detached_details.split(", ")[1].strip()

print(subprocess.check_output(f"git remote add __{username} [email protected]:{username}/py-ipv8.git", encoding="utf-8"))
print(subprocess.check_output("git remote add __Tribler [email protected]:Tribler/py-ipv8.git", encoding="utf-8"))

Expand Down Expand Up @@ -265,6 +272,7 @@ def modify_rest_manager(file_contents: str, element: ast.Constant, new_version_t
print(subprocess.check_output(f"git push -f -u __{username} automated_version_update", encoding="utf-8"))

# > Cleanup
print(subprocess.check_output(f"git checkout {original_branch}", encoding="utf-8"))
print(subprocess.check_output("git branch -D __automated_version_update", encoding="utf-8"))
print(subprocess.check_output("git remote remove __Tribler", encoding="utf-8"))
print(subprocess.check_output(f"git remote remove __{username}", encoding="utf-8"))
Expand Down