2
0

upload.py 615 B

123456789101112131415161718192021222324252627
  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!")
  10. sys.exit()
  11. print("Uploading", f.name)
  12. s3 = boto3.client('s3')
  13. s3.upload_file(str(f), 'releases.wagtail.io', 'nightly/dist/' + f.name, ExtraArgs={'ACL': 'public-read'})
  14. print("Updating latest.json")
  15. boto3.resource('s3').Object('releases.wagtail.io', 'nightly/latest.json').put(
  16. ACL='public-read',
  17. Body=json.dumps({
  18. "url": 'https://releases.wagtail.io/nightly/dist/' + f.name,
  19. })
  20. )