Update version_branch.yml
This commit is contained in:
21
.github/workflows/version_branch.yml
vendored
21
.github/workflows/version_branch.yml
vendored
@@ -352,6 +352,8 @@ jobs:
|
|||||||
header_re = re.compile(r'(?im)(VERSION[ ]*:[ ]*)([0-9]{2}[.][0-9]{2}[.][0-9]{2})')
|
header_re = re.compile(r'(?im)(VERSION[ ]*:[ ]*)([0-9]{2}[.][0-9]{2}[.][0-9]{2})')
|
||||||
|
|
||||||
manifest_marker_re = re.compile(r'(?is)<extension\b')
|
manifest_marker_re = re.compile(r'(?is)<extension\b')
|
||||||
|
# Joomla update server feeds commonly use <updates> root
|
||||||
|
updates_marker_re = re.compile(r'(?is)<updates\b|<update\b')
|
||||||
xml_version_re = re.compile(r'(?is)(<version[ ]*>)([^<]*?)(</version[ ]*>)')
|
xml_version_re = re.compile(r'(?is)(<version[ ]*>)([^<]*?)(</version[ ]*>)')
|
||||||
xml_date_res = [
|
xml_date_res = [
|
||||||
re.compile(r'(?is)(<creationDate[ ]*>)([^<]*?)(</creationDate[ ]*>)'),
|
re.compile(r'(?is)(<creationDate[ ]*>)([^<]*?)(</creationDate[ ]*>)'),
|
||||||
@@ -399,6 +401,7 @@ jobs:
|
|||||||
counters['header_replacements'] += n1
|
counters['header_replacements'] += n1
|
||||||
|
|
||||||
if p.suffix.lower() == '.xml':
|
if p.suffix.lower() == '.xml':
|
||||||
|
# Joomla manifest files
|
||||||
if manifest_marker_re.search(text):
|
if manifest_marker_re.search(text):
|
||||||
text2, n2 = xml_version_re.subn(lambda m: m.group(1) + new_version + m.group(3), text)
|
text2, n2 = xml_version_re.subn(lambda m: m.group(1) + new_version + m.group(3), text)
|
||||||
text = text2
|
text = text2
|
||||||
@@ -414,7 +417,23 @@ jobs:
|
|||||||
if text != original:
|
if text != original:
|
||||||
updated_manifests.append(str(p))
|
updated_manifests.append(str(p))
|
||||||
else:
|
else:
|
||||||
counters['xml_skipped_non_manifest'] += 1
|
# Special case: update server feeds (updates.xml, update.xml, or any XML containing <updates>/<update>)
|
||||||
|
if p.name.lower() in {'updates.xml', 'update.xml'} or updates_marker_re.search(text):
|
||||||
|
text2, n2 = xml_version_re.subn(lambda m: m.group(1) + new_version + m.group(3), text)
|
||||||
|
text = text2
|
||||||
|
if n2:
|
||||||
|
counters['xml_version_replacements'] += n2
|
||||||
|
|
||||||
|
for rx in xml_date_res:
|
||||||
|
text3, n3 = rx.subn(lambda m: m.group(1) + stamp + m.group(3), text)
|
||||||
|
text = text3
|
||||||
|
if n3:
|
||||||
|
counters['xml_date_replacements'] += n3
|
||||||
|
|
||||||
|
if text != original:
|
||||||
|
updated_manifests.append(str(p))
|
||||||
|
else:
|
||||||
|
counters['xml_skipped_non_manifest'] += 1
|
||||||
|
|
||||||
if text != original:
|
if text != original:
|
||||||
p.write_text(text, encoding='utf-8')
|
p.write_text(text, encoding='utf-8')
|
||||||
|
|||||||
Reference in New Issue
Block a user