-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try script for upload built and signed artifacts
- Loading branch information
1 parent
7cc3775
commit e7705f2
Showing
2 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Upload the artifacts to Cloudflare R2 Storage""" | ||
|
||
import os | ||
import boto3 | ||
|
||
BUCKET_NAME = os.getenv("BUCKET_NAME", "pypy-files") | ||
PYPY_VERSION = os.environ["PYPY_VERSION"] | ||
|
||
s3 = boto3.resource( | ||
's3', | ||
endpoint_url='https://8be772befd147a8df540aae0fa15c047.r2.cloudflarestorage.com', | ||
) | ||
|
||
|
||
def upload_file(file_name: str) -> None: | ||
"""Uploads a file to R2""" | ||
try: | ||
s3.upload_file(file_name, BUCKET_NAME, f"pypy/{PYPY_VERSION}/{file_name}") | ||
except Exception as e: | ||
print(f"Failed to upload {file_name} to {file_name}: {e}") | ||
raise e | ||
print(f"Uploaded {file_name}") | ||
|
||
|
||
if __name__ == "__main__": | ||
for file in os.listdir("./output"): | ||
upload_file(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters