mirror of
https://github.com/BLAKE3-team/BLAKE3
synced 2024-09-01 00:45:12 +02:00
add another retry loop to upload_github_release_asset.py
While we're at it, black format the .py files in this directory.
This commit is contained in:
parent
537e96747a
commit
56b72b1738
5
.github/workflows/build_b3sum.py
vendored
5
.github/workflows/build_b3sum.py
vendored
@ -9,8 +9,9 @@ import sys
|
||||
ROOT = Path(__file__).parent.parent.parent
|
||||
RUST_TARGET = sys.argv[1]
|
||||
|
||||
subprocess.run(["cargo", "build", "--target", sys.argv[1], "--release"],
|
||||
cwd=ROOT / "b3sum")
|
||||
subprocess.run(
|
||||
["cargo", "build", "--target", sys.argv[1], "--release"], cwd=ROOT / "b3sum"
|
||||
)
|
||||
|
||||
if platform.system() == "Windows":
|
||||
original_exe_name = "b3sum.exe"
|
||||
|
20
.github/workflows/upload_github_release_asset.py
vendored
20
.github/workflows/upload_github_release_asset.py
vendored
@ -3,6 +3,7 @@
|
||||
import github
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
RETRIES = 10
|
||||
|
||||
@ -10,7 +11,7 @@ g = github.Github(os.environ["GITHUB_TOKEN"])
|
||||
tag_name = os.environ["GITHUB_TAG"]
|
||||
tag_prefix = "refs/tags/"
|
||||
if tag_name.startswith(tag_prefix):
|
||||
tag_name = tag_name[len(tag_prefix):]
|
||||
tag_name = tag_name[len(tag_prefix) :]
|
||||
assert len(sys.argv) == 2
|
||||
asset_path = sys.argv[1]
|
||||
asset_name = os.path.basename(asset_path)
|
||||
@ -34,13 +35,20 @@ except github.GithubException as github_error:
|
||||
else:
|
||||
raise
|
||||
|
||||
releases = list(repo.get_releases())
|
||||
for release in releases:
|
||||
if release.tag_name == tag_name:
|
||||
break
|
||||
else:
|
||||
|
||||
def get_release():
|
||||
for i in range(RETRIES):
|
||||
releases = list(repo.get_releases())
|
||||
for release in releases:
|
||||
if release.tag_name == tag_name:
|
||||
return release
|
||||
print(f"Release for tag {repr(tag_name)} not found. Retrying...")
|
||||
time.sleep(1)
|
||||
raise RuntimeError("no release for tag " + repr(tag_name))
|
||||
|
||||
|
||||
release = get_release()
|
||||
|
||||
print("Uploading " + repr(asset_path) + "...")
|
||||
for i in range(RETRIES):
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user