mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 01:39:18 +02:00
Added a small json file in documentation to get releases info
This commit is contained in:
parent
3a95957dfe
commit
cf51d37a47
2 changed files with 35 additions and 1 deletions
34
docs/get-releases-json.py
Normal file
34
docs/get-releases-json.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
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()
|
Loading…
Add table
Add a link
Reference in a new issue