Rename tag zip and add branch zip
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
IamTheFij 2024-07-21 09:16:15 -07:00
parent 273199a9a6
commit ea982ee5a9
2 changed files with 9 additions and 4 deletions

View File

@ -84,5 +84,10 @@ def get_latest_sha(repository_url: str, branch_name: str) -> str:
raise ValueError(f"branch name '{branch_name}' not found for {repository_url}") raise ValueError(f"branch name '{branch_name}' not found for {repository_url}")
def get_ref_zip(repository_url: str, tag_name: str) -> str: def get_tag_zip(repository_url: str, tag_name: str) -> str:
return f"{repository_url}/archive/refs/tags/{tag_name}.zip" return f"{repository_url}/archive/refs/tags/{tag_name}.zip"
def get_branch_zip(repository_url: str, branch_name: str) -> str:
return f"{repository_url}/archive/{branch_name}.zip"

View File

@ -14,7 +14,7 @@ import requests
import yaml import yaml
from unhacs.git import get_latest_sha from unhacs.git import get_latest_sha
from unhacs.git import get_ref_zip from unhacs.git import get_tag_zip
from unhacs.git import get_repo_tags from unhacs.git import get_repo_tags
DEFAULT_HASS_CONFIG_PATH: Path = Path(".") DEFAULT_HASS_CONFIG_PATH: Path = Path(".")
@ -235,7 +235,7 @@ class Package:
def install_integration(self, hass_config_path: Path): def install_integration(self, hass_config_path: Path):
"""Installs the integration package.""" """Installs the integration package."""
zipball_url = get_ref_zip(self.url, self.version) zipball_url = get_tag_zip(self.url, self.version)
response = requests.get(zipball_url) response = requests.get(zipball_url)
response.raise_for_status() response.raise_for_status()
@ -266,7 +266,7 @@ class Package:
def install_fork_component(self, hass_config_path: Path): def install_fork_component(self, hass_config_path: Path):
"""Installs the integration from hass fork.""" """Installs the integration from hass fork."""
assert self.fork_component assert self.fork_component
zipball_url = get_ref_zip(self.url, self.version) zipball_url = get_tag_zip(self.url, self.version)
response = requests.get(zipball_url) response = requests.get(zipball_url)
response.raise_for_status() response.raise_for_status()