Remove support for release tag page url.
Only asset url is now accepted for fixed-release-tag-updates
This commit is contained in:
19
.github/scripts/update_mod_versions.py
vendored
19
.github/scripts/update_mod_versions.py
vendored
@@ -196,22 +196,15 @@ def process_mod(start_timestamp, name, meta_file):
|
|||||||
print("Download URL links to HEAD, checking latest commit...")
|
print("Download URL links to HEAD, checking latest commit...")
|
||||||
source = VersionSource.HEAD
|
source = VersionSource.HEAD
|
||||||
new_version = get_version_string(VersionSource.HEAD, owner, repo, start_timestamp)
|
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
|
source = VersionSource.SPECIFIC_TAG
|
||||||
tag_data = {}
|
tag_data = {}
|
||||||
|
|
||||||
if "/releases/download/" in download_url:
|
# Pattern: /releases/download/{tag}/{file} - tag is second-to-last
|
||||||
# Pattern: /releases/download/{tag}/{file} - tag is second-to-last
|
print("Download URL links to specific release asset, checking that asset's tag...")
|
||||||
print("Download URL links to specific release asset, checking that asset's tag...")
|
tag_name = download_url.split('/')[-2]
|
||||||
tag_name = download_url.split('/')[-2]
|
print(f"Checking release tag: {tag_name}")
|
||||||
print(f"Checking release tag: {tag_name}")
|
tag_data['name'] = 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
|
|
||||||
|
|
||||||
new_version = get_version_string(
|
new_version = get_version_string(
|
||||||
source, owner, repo, start_timestamp, tag_data=tag_data
|
source, owner, repo, start_timestamp, tag_data=tag_data
|
||||||
|
|||||||
@@ -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:
|
- *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 `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.
|
- 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`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -80,10 +80,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"$comment": "'downloadURL' points to a specific release page or asset",
|
"$comment": "'downloadURL' points to a specific release asset",
|
||||||
"properties": {
|
"properties": {
|
||||||
"downloadURL": {
|
"downloadURL": {
|
||||||
"pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/(tag/[^/]+|download/[^/]+/.+)$"
|
"pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/download/[^/]+/.+$"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"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",
|
"$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."
|
"errorMessage": "'automatic-version-check' must be true when 'fixed-release-tag-updates' is true."
|
||||||
},
|
},
|
||||||
"downloadURL": {
|
"downloadURL": {
|
||||||
"pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/(tag/[^/]+|download/[^/]+/.+)$",
|
"pattern": "^https?://github\\.com/[^/]+/[^/]+/releases/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."
|
"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": [
|
"required": [
|
||||||
"automatic-version-check"
|
"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": {
|
"else": {
|
||||||
"$comment": "Conditions when 'fixed-release-tag-updates' is false or absent",
|
"$comment": "Conditions when 'fixed-release-tag-updates' is false or absent",
|
||||||
|
|||||||
Reference in New Issue
Block a user