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