1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-06-02 22:00:12 +02:00

♟️ deploy: add global config github_token

This commit is contained in:
Michael Pöhn 2024-04-16 13:12:29 +02:00
parent 48aa699cda
commit 6b46fc29d8
No known key found for this signature in database
GPG Key ID: 725F386C05529A5A
2 changed files with 10 additions and 6 deletions

View File

@ -225,12 +225,16 @@
# Also make sure to limit access only to the GitHub repository you're deploying
# to. (https://github.com/settings/personal-access-tokens/new)
#
# github_token: {env: GITHUB_TOKEN}
# github_releases:
# - repo: f-droid/fdroidclient
# token: {env: GITHUB_TOKEN}
# packages:
# - org.fdroid.basic
# - org.fdroid.fdroid
# - repo: example/app
# token: {env: GITHUB_TOKEN_EXAMPLE}
# packages:
# - com.example.app
# Most git hosting services have hard size limits for each git repo.

View File

@ -887,7 +887,7 @@ def find_release_files(index_v2_path, repo_dir, package_names):
return release_files
def upload_to_github_releases(repo_section, gh_config):
def upload_to_github_releases(repo_section, gh_config, global_gh_token):
repo_dir = pathlib.Path(repo_section)
index_v2_path = repo_dir / 'index-v2.json'
if not index_v2_path.is_file():
@ -907,15 +907,15 @@ def upload_to_github_releases(repo_section, gh_config):
release_files = find_release_files(index_v2_path, repo_dir, package_names)
for repo_conf in gh_config:
upload_to_github_releases_repo(repo_conf, release_files)
upload_to_github_releases_repo(repo_conf, release_files, global_gh_token)
def upload_to_github_releases_repo(repo_conf, release_files):
def upload_to_github_releases_repo(repo_conf, release_files, global_gh_token):
repo = repo_conf.get('repo')
if not repo:
logging.warning(_("One of the 'github_releases' config items is missing the 'repo' value. skipping ..."))
return
token = repo_conf.get('token')
token = repo_conf.get('token') or global_gh_token
if not token:
logging.warning(_("One of the 'github_releases' config itmes is missing the 'token' value. skipping ..."))
return
@ -1067,7 +1067,7 @@ def main():
if config.get('virustotal_apikey'):
upload_to_virustotal(repo_section, config.get('virustotal_apikey'))
if config.get('github_releases'):
upload_to_github_releases(repo_section, config.get('github_releases'))
upload_to_github_releases(repo_section, config.get('github_releases'), config.get('github_token'))
binary_transparency_remote = config.get('binary_transparency_remote')
if binary_transparency_remote: