2
0

upload.py 699 B

123456789101112131415161718192021222324252627282930313233
  1. import json
  2. import pathlib
  3. import sys
  4. import boto3
  5. dist_folder = pathlib.Path.cwd() / "dist"
  6. try:
  7. f = next(dist_folder.glob("*.whl"))
  8. except StopIteration:
  9. print("No .whl files found in ./dist!") # noqa: T201
  10. sys.exit()
  11. print("Uploading", f.name) # noqa: T201
  12. s3 = boto3.client("s3")
  13. s3.upload_file(
  14. str(f),
  15. "releases.wagtail.io",
  16. "nightly/dist/" + f.name,
  17. ExtraArgs={"ACL": "public-read"},
  18. )
  19. print("Updating latest.json") # noqa: T201
  20. boto3.resource("s3").Object("releases.wagtail.io", "nightly/latest.json").put(
  21. ACL="public-read",
  22. Body=json.dumps(
  23. {
  24. "url": "https://releases.wagtail.org/nightly/dist/" + f.name,
  25. }
  26. ),
  27. )