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 hashlib
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
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__), ".."))
|
||||
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"]
|
||||
|
||||
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"
|
||||
|
||||
print(f"Uploading {new_basename}..")
|
||||
|
@ -86,14 +87,19 @@ bucket.upload_file(
|
|||
ExtraArgs=extra,
|
||||
)
|
||||
|
||||
if ordered_filenames[1] == new_basename:
|
||||
print("Copying to zulip-server-latest.tar.gz..")
|
||||
if (
|
||||
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(
|
||||
CopySource={"Bucket": bucket.name, "Key": f"server/{new_basename}"},
|
||||
Key="server/zulip-server-latest.tar.gz",
|
||||
ExtraArgs=extra,
|
||||
)
|
||||
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..")
|
||||
contents = ""
|
||||
|
|
Loading…
Reference in New Issue