added fancy tags

This commit is contained in:
Lachee 2025-05-15 12:22:18 +10:00
parent 2c81235043
commit 58809ce20d
No known key found for this signature in database
GPG Key ID: F1694B0D3BCBCD55

View File

@ -8,6 +8,18 @@ import os
import re import re
from urllib.parse import urlparse from urllib.parse import urlparse
# Define platform colors for badges
PLATFORM_COLORS = {
'android': 'brightgreen',
'webgl': 'yellow',
'ios': 'orange',
'linux (il2cpp)': 'black',
'linux (mono)': 'black',
'mac (mono)': 'white',
'mac (il2cpp)': 'white',
'windows (mono)': 'blue',
'windows (il2cpp)': 'blue'
}
def get_docker_hub_tags(repository, limit=1000): def get_docker_hub_tags(repository, limit=1000):
""" """
@ -86,6 +98,14 @@ def get_private_registry_tags(registry, repository):
data = response.json() data = response.json()
return data.get("tags", []) return data.get("tags", [])
def format_tag(registry, repository, platform, tag ):
# Get color for platform, default to blue if not found
colour = PLATFORM_COLORS.get(platform, 'blue')
safeTag = requests.utils.quote(tag.replace('-', '--'))
safePlatform = requests.utils.quote(platform)
url = requests.utils.quote(f"https://{registry}{repository}/tag/{tag}")
return f"![Static Badge](https://img.shields.io/badge/{safeTag}-{safePlatform}-{colour}?logo=docker&link={url})"
def main(): def main():
# Check for registry in environment variable if not specified in args # Check for registry in environment variable if not specified in args
@ -135,7 +155,7 @@ def main():
markdown += f"| {version} |" markdown += f"| {version} |"
for component in all_components: for component in all_components:
tag = versions[version].get(component, "") tag = versions[version].get(component, "")
markdown += f" {tag} |" markdown += format_tag(registry, repository, component, tag) + " |"
markdown += "\n" markdown += "\n"
# Read existing README.md # Read existing README.md