TUN-7392: Ignore duplicate artifact uploads for github release

This commit is contained in:
Devin Carr 2023-04-25 13:31:28 -07:00
parent c7f343a3b4
commit aec1d8f653
1 changed files with 11 additions and 1 deletions

View File

@ -166,7 +166,16 @@ def parse_args():
def upload_asset(release, filepath, filename, release_version, kv_account_id, namespace_id, kv_api_token):
logging.info("Uploading asset: %s", filename)
release.upload_asset(filepath, name=filename)
assets = release.get_assets()
uploaded = False
for asset in assets:
if asset.name == filename:
logging.info("asset already uploaded, skipping upload")
uploaded = True
break
if not uploaded:
release.upload_asset(filepath, name=filename)
# check and extract if the file is a tar and gzipped file (as is the case with the macos builds)
binary_path = filepath
@ -182,6 +191,7 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
binary_path = os.path.join(os.getcwd(), 'cfd', 'cloudflared')
# send the sha256 (the checksum) to workers kv
logging.info("Uploading sha256 checksum for: %s", filename)
pkg_hash = get_sha256(binary_path)
send_hash(pkg_hash, filename, release_version, kv_account_id, namespace_id, kv_api_token)