Skip to content

Commit

Permalink
Merge pull request #59 from devcontainers-contrib:danielbraun89/issue58
Browse files Browse the repository at this point in the history
[Bug]: gh-release requires git as part of the install process, but does not install it itself.
  • Loading branch information
danielbraun89 authored Jan 6, 2024
2 parents 1cb4f83 + 946f8d6 commit e027657
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nanolayer/installers/gh_release/resolvers/release_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import urllib
from typing import Any, Dict, List, Optional
import distutils.spawn

import invoke
from natsort import natsorted
Expand Down Expand Up @@ -81,6 +82,10 @@ def get_latest_release_tag(
release_tags = cls._filter_tags_by_regex(release_tags, release_tag_regex)
return natsorted(release_tags)[-1]

@classmethod
def _git_exists(cls) -> bool:
return distutils.spawn.find_executable("git") is not None

@classmethod
def resolve(
cls,
Expand All @@ -90,9 +95,10 @@ def resolve(
use_github_api: bool = False,
) -> str:
if asked_version == "latest":
if use_github_api:
if use_github_api or not cls._git_exists():
return cls.get_latest_release_tag(repo, release_tag_regex)
return cls.get_latest_git_version_tag(repo, release_tag_regex)
else:
return cls.get_latest_git_version_tag(repo, release_tag_regex)

else:
versions = cls.get_version_tags(repo, release_tag_regex)
Expand Down

0 comments on commit e027657

Please sign in to comment.