Skip to content
Snippets Groups Projects
Verified Commit cf51d37a authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Added a small json file in documentation to get releases info

parent 3a95957d
No related branches found
No related tags found
2 merge requests!751Master to develop,!700Added a small json file in documentation to get releases info
Pipeline #3778 passed with stages
in 4 minutes and 3 seconds
#!/bin/bash -eux
# Building sphinx and swagger docs
python -m sphinx . $BUILD_PATH
TARGET_PATH="$BUILD_PATH/swagger" ./build_swagger.sh
python ./get-releases-json.py > $BUILD_PATH/releases.json
import json
import subprocess
from distutils.version import StrictVersion
def get_versions():
output = subprocess.check_output(
["git", "tag", "-l", "--format=%(creatordate:iso-strict)|%(refname:short)"]
)
tags = []
for line in output.decode().splitlines():
try:
date, tag = line.split("|")
except (ValueError):
continue
if not date or not tag:
continue
tags.append({"id": tag, "date": date})
return sorted(tags, key=lambda tag: StrictVersion(tag["id"]), reverse=True)
def main():
versions = get_versions()
data = {"count": len(versions), "releases": versions}
print(json.dumps(data))
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment