Initial commit

This commit is contained in:
Sohrab Behdani 2023-03-23 14:26:29 +03:30 committed by GitHub
commit c2d68eb3aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
94 changed files with 2339 additions and 0 deletions

42
tools/upload_assest.py Normal file
View file

@ -0,0 +1,42 @@
import logging
import os
import sys
from datetime import datetime
from glob import glob
from github import Github
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
api_key = os.getenv("api_key", None)
current_date = datetime.today().strftime("%Y-%m-%d")
path = glob(r"/__w/parch-iso-template/parch-iso-template/out/*.iso")[
0
] # edit this if your not use in workflow
repo_name = os.getenv("name", None)
release_name = os.getenv("release_name", None)
logging.info("Starting at %s", current_date)
if not (repo_name and api_key and release_name):
logging.error(
"'repo_name'/'api_key'/'release_name' not found in your envs."
"please add this and run again"
)
sys.exit(1)
gh = Github(api_key)
repo = gh.get_repo(f"parch-os/{repo_name}")
release = repo.get_release(release_name)
logging.info("statrting Upload ISO to release")
release.upload_asset(path=path)
logging.info("ISO upload is done")
logging.info("statrting Upload ISO gpg key to release")
release.upload_asset(
"/__w/parch-iso-template/parch-iso-template/iso/public.key"
) # noqa: E501:w