38 lines
1014 B
Python
38 lines
1014 B
Python
from gitea.api import GiteaApi
|
|
from gitea.config import GiteaConfig
|
|
import giteapy
|
|
import os
|
|
import json
|
|
from datetime import datetime
|
|
|
|
from gitea import GiteaUtils
|
|
|
|
|
|
current_file_path = os.path.abspath(__file__)
|
|
params = {
|
|
"owner": "CDN",
|
|
"repo": "bifrost-registry",
|
|
"release_id": 8845,
|
|
"attachment_path": os.path.abspath(
|
|
os.path.join(os.path.dirname(current_file_path), "..", "registry.zip")
|
|
),
|
|
}
|
|
|
|
def main():
|
|
gitea_instance = GiteaApi()
|
|
gitea_utils = GiteaUtils(gitea_instance)
|
|
assets = gitea_utils.get_release(**params).assets
|
|
if not os.path.isfile(params["attachment_path"]):
|
|
print(f"File {params['attachment_path']} does not exist")
|
|
exit(1)
|
|
gitea_utils.update_release(**params)
|
|
for asset in assets:
|
|
if asset.name == "registry.zip":
|
|
params["attachment_id"] = asset.id
|
|
gitea_utils.delete_release_attachment(**params)
|
|
gitea_utils.create_release_attachment(**params)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|