Skip to content

Commit

Permalink
- update code deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
maycuatroi committed Apr 17, 2024
1 parent 0774774 commit 557868f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions scripts/create-new-release.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,16 @@ def bump_version(version):
subprocess.run(["git", "config", "user.name", username])

# add git token to avoid password prompt
current_origin_url = subprocess.run(
["git", "remote", "get-url", "origin"], capture_output=True
).stdout.decode()
if "@" not in current_origin_url:
if current_origin_url.startswith("git@"):
current_origin_url = current_origin_url.replace("git@", "https://")
current_origin_url = current_origin_url.replace(":", "/")
elif current_origin_url.startswith("https://"):
current_origin_url = current_origin_url.replace(
"https://", f"https://{github_token}@"
)
current_origin_url = (
subprocess.run(["git", "remote", "get-url", "origin"], capture_output=True)
.stdout.decode()
.strip()
)
if "@" not in current_origin_url and "https://" in current_origin_url:
if not current_origin_url.endswith(".git"):
current_origin_url += ".git"
new_origin_url = current_origin_url.replace(
"https://", f"https://{github_token}:{github_token}@"
"https://", f"https://{github_token}@"
)
subprocess.run(["git", "remote", "set-url", "origin", new_origin_url])

Expand Down

0 comments on commit 557868f

Please sign in to comment.