mirror of https://github.com/zulip/zulip.git
upload-release: Only copy full releases to zulip-server-latest.tar.gz.
`zulip-server-6.0-pre0.tar.gz` should not be copied to `zulip-server-latest.tar.gz`.
This commit is contained in:
parent
345ed1d09d
commit
6cd4d907ba
|
@ -2,9 +2,10 @@
|
||||||
import argparse
|
import argparse
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from typing import IO, Dict
|
from typing import IO, Dict, List, cast
|
||||||
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
|
||||||
from scripts.lib.setup_path import setup_path
|
from scripts.lib.setup_path import setup_path
|
||||||
|
@ -71,7 +72,7 @@ for obj_summary in bucket.objects.filter(Prefix="server/zulip-server-"):
|
||||||
|
|
||||||
file_hashes[filename] = metadata["sha256sum"]
|
file_hashes[filename] = metadata["sha256sum"]
|
||||||
|
|
||||||
ordered_filenames = natsorted(file_hashes.keys(), reverse=True)
|
ordered_filenames = cast(List[str], natsorted(file_hashes.keys(), reverse=True))
|
||||||
assert ordered_filenames[0] == "zulip-server-latest.tar.gz"
|
assert ordered_filenames[0] == "zulip-server-latest.tar.gz"
|
||||||
|
|
||||||
print(f"Uploading {new_basename}..")
|
print(f"Uploading {new_basename}..")
|
||||||
|
@ -86,14 +87,19 @@ bucket.upload_file(
|
||||||
ExtraArgs=extra,
|
ExtraArgs=extra,
|
||||||
)
|
)
|
||||||
|
|
||||||
if ordered_filenames[1] == new_basename:
|
if (
|
||||||
print("Copying to zulip-server-latest.tar.gz..")
|
next(name for name in ordered_filenames if re.match(r"^zulip-server-(\d+\.\d+)\.tar.gz$", name))
|
||||||
|
== new_basename
|
||||||
|
):
|
||||||
|
print("This looks like the most recent full release; copying to zulip-server-latest.tar.gz..")
|
||||||
bucket.copy(
|
bucket.copy(
|
||||||
CopySource={"Bucket": bucket.name, "Key": f"server/{new_basename}"},
|
CopySource={"Bucket": bucket.name, "Key": f"server/{new_basename}"},
|
||||||
Key="server/zulip-server-latest.tar.gz",
|
Key="server/zulip-server-latest.tar.gz",
|
||||||
ExtraArgs=extra,
|
ExtraArgs=extra,
|
||||||
)
|
)
|
||||||
file_hashes["zulip-server-latest.tar.gz"] = file_hashes[new_basename]
|
file_hashes["zulip-server-latest.tar.gz"] = file_hashes[new_basename]
|
||||||
|
else:
|
||||||
|
print("Not copying to zulip-server-latest.tar.gz!")
|
||||||
|
|
||||||
print("Updating SHA256SUMS.txt..")
|
print("Updating SHA256SUMS.txt..")
|
||||||
contents = ""
|
contents = ""
|
||||||
|
|
Loading…
Reference in New Issue