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
workflow_dispatch: # Allow manual triggering
workflow_run: # Trigger from images
workflows:
types:
- completed
push:
paths:
- scripts/update-readme.py
- .gitea/workflows/update-readme.py
jobs:
update-readme:

View File

@ -1,25 +1,9 @@
#!/usr/bin/env python3
import argparse
import requests
import json
import sys
import os
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):
"""
@ -100,11 +84,14 @@ def get_private_registry_tags(registry, repository):
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})"
registryName = "Docker Hub"
url = f"https://hub.docker.com/r/{repository}/tags?name={tag}"
if registry:
registryName = registry
url = f"https://{registry}{repository}/tag/{tag}"
return f"[{registryName}]({url})"
def main():
@ -155,7 +142,10 @@ def main():
markdown += f"| {version} |"
for component in all_components:
tag = versions[version].get(component, "")
if tag:
markdown += format_tag(registry, repository, component, tag) + " |"
else:
markdown += "❌ |"
markdown += "\n"
# Read existing README.md