diff --git a/.github/scripts/update_mod_versions.py b/.github/scripts/update_mod_versions.py index 5e3c4cf2..2b8e552d 100755 --- a/.github/scripts/update_mod_versions.py +++ b/.github/scripts/update_mod_versions.py @@ -196,22 +196,15 @@ def process_mod(start_timestamp, name, meta_file): print("Download URL links to HEAD, checking latest commit...") source = VersionSource.HEAD new_version = get_version_string(VersionSource.HEAD, owner, repo, start_timestamp) - elif (meta.get('fixed-release-tag-updates') == True): + elif (meta.get('fixed-release-tag-updates') == True) and "/releases/download/" in download_url: source = VersionSource.SPECIFIC_TAG tag_data = {} - if "/releases/download/" in download_url: - # Pattern: /releases/download/{tag}/{file} - tag is second-to-last - print("Download URL links to specific release asset, checking that asset's tag...") - tag_name = download_url.split('/')[-2] - print(f"Checking release tag: {tag_name}") - tag_data['name'] = tag_name - else: - # Pattern: /releases/tag/{tag} - tag is last - print("Download URL links to specific release tag, checking that tag...") - tag_name = download_url.split('/')[-1] - print(f"Checking release tag: {tag_name}") - tag_data['name'] = tag_name + # Pattern: /releases/download/{tag}/{file} - tag is second-to-last + print("Download URL links to specific release asset, checking that asset's tag...") + tag_name = download_url.split('/')[-2] + print(f"Checking release tag: {tag_name}") + tag_data['name'] = tag_name new_version = get_version_string( source, owner, repo, start_timestamp, tag_data=tag_data diff --git a/README.md b/README.md index 7c55d8cf..3d43b494 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ This file stores essential metadata in JSON format. **Make sure you adhere to th - *fixed-release-tag-updates*: (*Optional*) Set to `true` if your mod uses a fixed release tag and still wants to auto-update when modifying the underlying files. This can be useful for repositories with multiple mods, allowing you to have a release tag dedicated for each mod where you upload new versions. Note that: - Requires `automatic-version-check` to also be set to `true`. - Requires that the `version` field is not set as the version will be extracted from the asset's upload date. - - The `downloadURL` must point to a specific release asset or a specific release page using a link such: `https://github.com/author/repo/releases/tag/my-release-tag` or `https://github.com/author/repo/releases/download/my-release-tag/mod.zip`. + - The `downloadURL` must point to a specific release asset using a link such as `https://github.com/author/repo/releases/download/my-release-tag/mod.zip`. diff --git a/schema/meta.schema.json b/schema/meta.schema.json index 8ac6c4ef..786f8ac3 100644 --- a/schema/meta.schema.json +++ b/schema/meta.schema.json @@ -80,10 +80,10 @@ ] }, { - "$comment": "'downloadURL' points to a specific release page or asset", + "$comment": "'downloadURL' points to a specific release asset", "properties": { "downloadURL": { - "pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/(tag/[^/]+|download/[^/]+/.+)$" + "pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/download/[^/]+/.+$" } }, "required": [ @@ -105,7 +105,7 @@ } ] }, - "errorMessage": "When 'downloadURL' points to a specific GitHub release tag/asset AND 'automatic-version-check' is true, 'fixed-release-tag-updates' must also be true. This prevents accidental update freezing." + "errorMessage": "When 'downloadURL' points to a specific GitHub release asset AND 'automatic-version-check' is true, 'fixed-release-tag-updates' must also be true. This prevents accidental update freezing." }, { "$comment": "This rule checks the value of 'fixed-release-tag-updates' and guarantees consistency", @@ -133,14 +133,14 @@ "errorMessage": "'automatic-version-check' must be true when 'fixed-release-tag-updates' is true." }, "downloadURL": { - "pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/(tag/[^/]+|download/[^/]+/.+)$", - "errorMessage": "When 'fixed-release-tag-updates' is true, 'downloadURL' must point to a specific GitHub release tag (e.g., '/releases/tag/v1.0.0') or a specific release asset (e.g., '/releases/download/v1.0.0/asset.zip'), NOT a branch head or latest release URL." + "pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/download/[^/]+/.+$", + "errorMessage": "When 'fixed-release-tag-updates' is true, 'downloadURL' must point to a specific GitHub specific release asset (e.g., '/releases/download/v1.0.0/asset.zip'), NOT a branch head or latest release URL." } }, "required": [ "automatic-version-check" ], - "errorMessage": "When 'fixed-release-tag-updates' is true: 'version' must be absent, 'automatic-version-check' must be true, and 'downloadURL' must point to a specific release tag or asset." + "errorMessage": "When 'fixed-release-tag-updates' is true: 'version' must be absent, 'automatic-version-check' must be true, and 'downloadURL' must point to a specific release asset." }, "else": { "$comment": "Conditions when 'fixed-release-tag-updates' is false or absent",