diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index ea41618f..858fd5be 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -17,10 +17,6 @@ jobs: with: fetch-depth: 0 - - name: Get Previous tag - id: previoustag - run: echo "::set-output name=OLDVERSION::$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))" - - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -100,8 +96,8 @@ jobs: - name: Create & Push Tag working-directory: ./pmmconfigs run: | - git tag ${{ steps.previoustag.outputs.OLDVERSION }} - git push origin ${{ steps.previoustag.outputs.OLDVERSION }} + git tag ${{ steps.get_version.outputs.VERSION }} + git push origin ${{ steps.get_version.outputs.VERSION }} - name: Create release id: create_release @@ -109,5 +105,5 @@ jobs: with: body: ${{ steps.notes.outputs.notes }} token: ${{ secrets.PAT }} - tag_name: ${{ steps.previoustag.outputs.OLDVERSION }} + tag_name: ${{ steps.get_version.outputs.VERSION }} repository: meisnate12/Plex-Meta-Manager-Configs \ No newline at end of file diff --git a/VERSION b/VERSION index 958c75ce..793ea206 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.17.3-develop43 +1.17.3-develop44 diff --git a/modules/github.py b/modules/github.py index 24e702e5..b7aa3a87 100644 --- a/modules/github.py +++ b/modules/github.py @@ -10,6 +10,7 @@ class GitHub: def __init__(self, config): self.config = config self._configs_url = None + self._config_tags = [] def latest_release_notes(self): response = self.config.get_json(f"{base_url}/releases/latest") @@ -30,14 +31,22 @@ class GitHub: return "\n".join(commits) @property - def configs_url(self): - if self._configs_url is None: + def config_tags(self): + if not self._config_tags: try: - config_tags = [r["ref"][10:] for r in self.config.get_json(f"{base_url}-Configs/git/refs/tags")] + self._config_tags = [r["ref"][10:] for r in self.config.get_json(f"{base_url}-Configs/git/refs/tags")] except TypeError: - config_tags = [] - if self.config.version[1] in config_tags: - self._configs_url = f"{configs_raw_url}/{self.config.version[1]}/" - else: - self._configs_url = f"{configs_raw_url}/master/" + pass + return self._config_tags + + @property + def configs_url(self): + if self._configs_url is None: + self._configs_url = f"{configs_raw_url}/master/" + if self.config.latest_version[1] != self.config.version[1]: + if self.config.version[1] in self.config_tags: + self._configs_url = f"{configs_raw_url}/{self.config.version[1]}/" + elif not self.config.check_nightly and self.config.version[2] > 0: + if util.get_develop()[2] >= self.config.version[2]: + self._configs_url = f"{configs_raw_url}/{self.config.version[1]}/" return self._configs_url diff --git a/modules/util.py b/modules/util.py index 499be298..d6614b17 100644 --- a/modules/util.py +++ b/modules/util.py @@ -98,14 +98,35 @@ start_time = None def current_version(version, nightly=False): if nightly: - return get_version("nightly") + return get_nightly() elif version[2] > 0: - new_version = get_version("develop") + new_version = get_develop() if version[1] != new_version[1] or new_version[2] >= version[2]: return new_version - return get_version("nightly") + return get_nightly() else: - return get_version("master") + return get_master() + +nightly_version = None +def get_nightly(): + global nightly_version + if nightly_version is None: + nightly_version = get_version("nightly") + return nightly_version + +develop_version = None +def get_develop(): + global develop_version + if develop_version is None: + develop_version = get_version("develop") + return develop_version + +master_version = None +def get_master(): + global master_version + if master_version is None: + master_version = get_version("master") + return master_version def get_version(level): try: