mirror of
https://github.com/terrapkg/packages.git
synced 2026-06-02 18:02:19 +00:00
28 lines
636 B
Python
28 lines
636 B
Python
import os
|
|
import requests
|
|
import re
|
|
|
|
NAME = "adwaita++-icons"
|
|
REPO = "Bonandry/adwaita-plus"
|
|
REGEX_VER = r"Version:\s*([\.\d]+)\n"
|
|
SPEC = f"{NAME}.spec"
|
|
LINK = f"https://api.github.com/repos/{REPO}/releases/latest"
|
|
|
|
|
|
token = os.getenv("GITHUB_TOKEN")
|
|
ver = requests.get(LINK, headers={"Authorization": f"Bearer {token}"}).json()[
|
|
"tag_name"
|
|
][1:]
|
|
|
|
with open(SPEC, "r") as f:
|
|
matches = re.findall(REGEX_VER, f.read())
|
|
|
|
if not len(matches):
|
|
exit(f"{NAME}: Failed to match regex!")
|
|
cur = matches[0]
|
|
if ver == cur:
|
|
exit(f"{NAME}: Up to date!")
|
|
|
|
print(f"{NAME}: {cur} -> {ver}")
|
|
os.system(f"rpmdev-bumpspec -n {ver} {SPEC}")
|