Skip to content

Commit

Permalink
TUN-8585: Avoid creating GH client when dry-run is true
Browse files Browse the repository at this point in the history
- copy exe files from windows build
  • Loading branch information
lmpn committed Aug 5, 2024
1 parent bd9e020 commit 86f3300
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions .teamcity/package-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ for arch in ${windowsArchs[@]}; do
make cloudflared-msi
# Copy msi into final directory
mv cloudflared-$VERSION-$arch.msi $FINAL_ARTIFACT_DIR/cloudflared-windows-$arch.msi
cp $BUILT_ARTIFACT_DIR/cloudflared-windows-$arch.exe $FINAL_ARTIFACT_DIR/cloudflared-windows-$arch.exe
done
27 changes: 14 additions & 13 deletions github_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ def main():
""" Attempts to upload Asset to Github Release. Creates Release if it doesn't exist """
try:
args = parse_args()
client = Github(args.api_key)
repo = client.get_repo(CLOUDFLARED_REPO)
release = get_or_create_release(repo, args.release_version, args.dry_run)

if args.dry_run:
if os.path.isdir(args.path):
Expand All @@ -229,17 +226,21 @@ def main():
else:
logging.error("dryrun failed")
return

if os.path.isdir(args.path):
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
for filename in onlyfiles:
binary_path = os.path.join(args.path, filename)
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
args.kv_api_token)
move_asset(binary_path, filename)
else:
upload_asset(release, args.path, args.name, args.release_version, args.kv_account_id, args.namespace_id,
args.kv_api_token)
client = Github(args.api_key)
repo = client.get_repo(CLOUDFLARED_REPO)
release = get_or_create_release(repo, args.release_version, args.dry_run)

if os.path.isdir(args.path):
onlyfiles = [f for f in listdir(args.path) if isfile(join(args.path, f))]
for filename in onlyfiles:
binary_path = os.path.join(args.path, filename)
upload_asset(release, binary_path, filename, args.release_version, args.kv_account_id, args.namespace_id,
args.kv_api_token)
move_asset(binary_path, filename)
else:
upload_asset(release, args.path, args.name, args.release_version, args.kv_account_id, args.namespace_id,
args.kv_api_token)

except Exception as e:
logging.exception(e)
Expand Down

0 comments on commit 86f3300

Please sign in to comment.