Skip to content

Commit 50a0c44

Browse files
committed
TUN-7392: Ignore release checksum upload if asset already uploaded
1 parent 7639143 commit 50a0c44

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

github_release.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,14 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
170170
uploaded = False
171171
for asset in assets:
172172
if asset.name == filename:
173-
logging.info("asset already uploaded, skipping upload")
174173
uploaded = True
175174
break
176175

177-
if not uploaded:
178-
release.upload_asset(filepath, name=filename)
176+
if uploaded:
177+
logging.info("asset already uploaded, skipping upload")
178+
return
179+
180+
release.upload_asset(filepath, name=filename)
179181

180182
# check and extract if the file is a tar and gzipped file (as is the case with the macos builds)
181183
binary_path = filepath
@@ -195,6 +197,7 @@ def upload_asset(release, filepath, filename, release_version, kv_account_id, na
195197
pkg_hash = get_sha256(binary_path)
196198
send_hash(pkg_hash, filename, release_version, kv_account_id, namespace_id, kv_api_token)
197199

200+
def move_asset(filepath, filename):
198201
# create the artifacts directory if it doesn't exist
199202
artifact_path = os.path.join(os.getcwd(), 'artifacts')
200203
if not os.path.isdir(artifact_path):
@@ -225,6 +228,7 @@ def main():
225228
binary_path = os.path.join(args.path, filename)
226229
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
227230
args.kv_api_token)
231+
move_asset(binary_path, filename)
228232
else:
229233
upload_asset(release, args.path, args.name, args.release_version, args.kv_account_id, args.namespace_id,
230234
args.kv_api_token)

0 commit comments

Comments
 (0)