2020-09-23 20:25:08 +00:00
|
|
|
# MIT licensed
|
|
|
|
# Copyright (c) 2020 Felix Yan <felixonmars@archlinux.org>, et al.
|
|
|
|
|
|
|
|
import re
|
2020-09-23 20:51:28 +00:00
|
|
|
from .cmd import run_cmd # type: ignore
|
2020-09-23 20:25:08 +00:00
|
|
|
|
|
|
|
async def get_version(
|
|
|
|
name, conf, *, cache, keymanager=None
|
|
|
|
):
|
|
|
|
git = conf['git']
|
|
|
|
cmd = f"git ls-remote -t --refs {git}"
|
|
|
|
data = await cache.get(cmd, run_cmd)
|
|
|
|
regex = "(?<=refs/tags/).*$"
|
|
|
|
|
2020-09-23 20:51:28 +00:00
|
|
|
return re.findall(regex, data, re.MULTILINE)
|