0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-21 18:09:02 +01:00
wagtail/scripts/nightly/upload.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
699 B
Python
Raw Normal View History

2020-10-13 14:53:25 +02:00
import json
import pathlib
import sys
import boto3
dist_folder = pathlib.Path.cwd() / "dist"
try:
f = next(dist_folder.glob("*.whl"))
except StopIteration:
print("No .whl files found in ./dist!") # noqa: T201
sys.exit()
print("Uploading", f.name) # noqa: T201
s3 = boto3.client("s3")
s3.upload_file(
str(f),
"releases.wagtail.io",
"nightly/dist/" + f.name,
ExtraArgs={"ACL": "public-read"},
)
print("Updating latest.json") # noqa: T201
boto3.resource("s3").Object("releases.wagtail.io", "nightly/latest.json").put(
ACL="public-read",
Body=json.dumps(
{
"url": "https://releases.wagtail.org/nightly/dist/" + f.name,
}
2022-02-14 14:25:00 +01:00
),
)