updated readme generation

This commit is contained in:
Lachee 2025-05-16 17:13:00 +10:00
parent 605772a093
commit 19d9030c3c
No known key found for this signature in database
GPG Key ID: F1694B0D3BCBCD55
2 changed files with 18 additions and 25 deletions

View File

@ -5,9 +5,12 @@ on:
- cron: '0 0 * * *' # Run daily at midnight - cron: '0 0 * * *' # Run daily at midnight
workflow_dispatch: # Allow manual triggering workflow_dispatch: # Allow manual triggering
workflow_run: # Trigger from images workflow_run: # Trigger from images
workflows: types:
types: - completed
- completed push:
paths:
- scripts/update-readme.py
- .gitea/workflows/update-readme.py
jobs: jobs:
update-readme: update-readme:

View File

@ -1,25 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import argparse
import requests import requests
import json
import sys import sys
import os import os
import re import re
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):
""" """
@ -100,11 +84,14 @@ def get_private_registry_tags(registry, repository):
def format_tag(registry, repository, platform, tag ): def format_tag(registry, repository, platform, tag ):
# Get color for platform, default to blue if not found # Get color for platform, default to blue if not found
colour = PLATFORM_COLORS.get(platform, 'blue') registryName = "Docker Hub"
safeTag = requests.utils.quote(tag.replace('-', '--')) url = f"https://hub.docker.com/r/{repository}/tags?name={tag}"
safePlatform = requests.utils.quote(platform)
url = requests.utils.quote(f"https://{registry}{repository}/tag/{tag}") if registry:
return f"![Static Badge](https://img.shields.io/badge/{safeTag}-{safePlatform}-{colour}?logo=docker&link={url})" registryName = registry
url = f"https://{registry}{repository}/tag/{tag}"
return f"[{registryName}]({url})"
def main(): def main():
@ -155,7 +142,10 @@ 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 += format_tag(registry, repository, component, tag) + " |" if tag:
markdown += format_tag(registry, repository, component, tag) + " |"
else:
markdown += "❌ |"
markdown += "\n" markdown += "\n"
# Read existing README.md # Read existing README.md