summary refs log tree commit diff
path: root/scripts-dev
diff options
context:
space:
mode:
Diffstat (limited to 'scripts-dev')
-rwxr-xr-xscripts-dev/build_debian_packages.py4
-rwxr-xr-xscripts-dev/release.py36
2 files changed, 25 insertions, 15 deletions
diff --git a/scripts-dev/build_debian_packages.py b/scripts-dev/build_debian_packages.py

index de2a134544..88c8419400 100755 --- a/scripts-dev/build_debian_packages.py +++ b/scripts-dev/build_debian_packages.py
@@ -32,8 +32,8 @@ DISTS = ( "debian:sid", # (EOL not specified yet) (our EOL forced by Python 3.11 is 2027-10-24) "ubuntu:focal", # 20.04 LTS (EOL 2025-04) (our EOL forced by Python 3.8 is 2024-10-14) "ubuntu:jammy", # 22.04 LTS (EOL 2027-04) (our EOL forced by Python 3.10 is 2026-10-04) - "ubuntu:lunar", # 23.04 (EOL 2024-01) (our EOL forced by Python 3.11 is 2027-10-24) - "ubuntu:mantic", # 23.10 (EOL 2024-07) (our EOL forced by Python 3.11 is 2027-10-24) + "ubuntu:noble", # 24.04 LTS (EOL 2029-06) + "ubuntu:oracular", # 24.10 (EOL 2025-07) "debian:trixie", # (EOL not specified yet) ) diff --git a/scripts-dev/release.py b/scripts-dev/release.py
index 4435624267..b14b61c705 100755 --- a/scripts-dev/release.py +++ b/scripts-dev/release.py
@@ -40,7 +40,7 @@ import commonmark import git from click.exceptions import ClickException from git import GitCommandError, Repo -from github import Github +from github import BadCredentialsException, Github from packaging import version @@ -323,10 +323,8 @@ def tag(gh_token: Optional[str]) -> None: def _tag(gh_token: Optional[str]) -> None: """Tags the release and generates a draft GitHub release""" - if gh_token: - # Test that the GH Token is valid before continuing. - gh = Github(gh_token) - gh.get_user() + # Test that the GH Token is valid before continuing. + check_valid_gh_token(gh_token) # Make sure we're in a git repo. repo = get_repo_and_check_clean_checkout() @@ -469,10 +467,8 @@ def upload(gh_token: Optional[str]) -> None: def _upload(gh_token: Optional[str]) -> None: """Upload release to pypi.""" - if gh_token: - # Test that the GH Token is valid before continuing. - gh = Github(gh_token) - gh.get_user() + # Test that the GH Token is valid before continuing. + check_valid_gh_token(gh_token) current_version = get_package_version() tag_name = f"v{current_version}" @@ -569,10 +565,8 @@ def wait_for_actions(gh_token: Optional[str]) -> None: def _wait_for_actions(gh_token: Optional[str]) -> None: - if gh_token: - # Test that the GH Token is valid before continuing. - gh = Github(gh_token) - gh.get_user() + # Test that the GH Token is valid before continuing. + check_valid_gh_token(gh_token) # Find out the version and tag name. current_version = get_package_version() @@ -806,6 +800,22 @@ def get_repo_and_check_clean_checkout( return repo +def check_valid_gh_token(gh_token: Optional[str]) -> None: + """Check that a github token is valid, if supplied""" + + if not gh_token: + # No github token supplied, so nothing to do. + return + + try: + gh = Github(gh_token) + + # We need to lookup name to trigger a request. + _name = gh.get_user().name + except BadCredentialsException as e: + raise click.ClickException(f"Github credentials are bad: {e}") + + def find_ref(repo: git.Repo, ref_name: str) -> Optional[git.HEAD]: """Find the branch/ref, looking first locally then in the remote.""" if ref_name in repo.references: