Also publish a file containing the latest release

environments/review-docs-funkw-lxqqys/deployments/2363
Eliot Berriot 2019-08-23 09:27:47 +02:00
rodzic 60758358f3
commit 46039e4f03
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: DD6965E2476E5C27
2 zmienionych plików z 21 dodań i 4 usunięć

Wyświetl plik

@ -3,3 +3,4 @@
python -m sphinx . $BUILD_PATH
TARGET_PATH="$BUILD_PATH/swagger" ./build_swagger.sh
python ./get-releases-json.py > $BUILD_PATH/releases.json
python ./get-releases-json.py --latest > $BUILD_PATH/latest

Wyświetl plik

@ -1,3 +1,4 @@
import argparse
import json
import subprocess
@ -32,11 +33,26 @@ def get_versions():
return sorted(valid, key=lambda tag: StrictVersion(tag["id"]), reverse=True)
def main():
def main(latest=False):
versions = get_versions()
data = {"count": len(versions), "releases": versions}
print(json.dumps(data))
if latest:
print(versions[0]["id"])
else:
data = {"count": len(versions), "releases": versions}
print(json.dumps(data, sort_keys=True, indent=2))
if __name__ == "__main__":
main()
parser = argparse.ArgumentParser(
"""
Compile release data and output in in JSON format
"""
)
parser.add_argument(
"-l",
"--latest",
action="store_true",
help="Only print the latest version then exit",
)
args = parser.parse_args()
main(latest=args.latest)