1
0

Remove support for release tag page url.

Only asset url is now accepted for fixed-release-tag-updates
This commit is contained in:
Gabriel Freitas
2025-07-07 12:06:11 -03:00
parent 13479ddc91
commit 412c6df3d0
3 changed files with 13 additions and 20 deletions

View File

@@ -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

View File

@@ -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`.

View File

@@ -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",