Ejemplo n.º 1
0
    def release_from_tag(self, tag_name):
        """Get a release by tag name.
        release_from_tag() returns a release with specified tag
        while release() returns a release with specified release id
        :param str tag_name: (required) name of tag
        :returns: :class:`Release <github3.repos.release.Release>`
        """

        repo = self.gh_repo
        url = repo._build_url('releases', 'tags', tag_name, base_url=repo._api)
        json = repo._json(repo._get(url), 200)
        return Release(json, repo) if json else None
Ejemplo n.º 2
0
def release_from_tag(repo, tag_name):
    """Get a release by tag name.
    release_from_tag() returns a release with specified tag
    while release() returns a release with specified release id
    :param str tag_name: (required) name of tag
    :returns: :class:`Release <github3.repos.release.Release>`
    """
    # release_from_tag adapted from
    # https://github.com/sigmavirus24/github3.py/blob/38de787e465bffc63da73d23dc51f50d86dc903d/github3/repos/repo.py#L1781-L1793

    url = repo._build_url('releases', 'tags', tag_name, base_url=repo._api)
    json_obj = repo._json(repo._get(url), 200)
    return Release(json_obj, repo) if json_obj else None
Ejemplo n.º 3
0
def upload_ipa_github(ipa_path: Path, github_release: Release, name: str | None = None, ver: str | None = None) -> str:
    """Uses github3.py package to upload IPA to the specified Release using the GitHub API.
    
    The name and version are concatenated to make the github release asset name, otherwise the filename from the ipa_path is used.

    Args:
        ipa_path (Path): Path to the ipa to be uploaded.
        github_release (Release): github3.py Release object that will be used as the location to upload to.
        name (str): The filename to be used on the uploaded ipa (do not include the .ipa extension).
        ver (str): The version to be concatenated to the end of the filename on the uploaded ipa.

    Returns:
        str: The download url for the uploaded IPA.
    """
    with open(ipa_path, "rb") as file:
        label = f"{name}-{ver}.ipa" if name is not None and ver is not None else ipa_path.name
        uploaded_asset = github_release.upload_asset(content_type="application/octet-stream", name=label, asset=file)
    return uploaded_asset.browser_download_url
Ejemplo n.º 4
0
def _release(payload):
    from github3.repos.release import Release
    release = payload.get('release')
    if release:
        payload['release'] = Release(release)
    return payload