1. try #1
@@ -331,13 +331,13 @@ jobs:
|
|||||||
cat << 'EOF' > update_script.py
|
cat << 'EOF' > update_script.py
|
||||||
import os, re
|
import os, re
|
||||||
|
|
||||||
|
# 1. docker-compose.yml generieren
|
||||||
env_keys = [
|
env_keys = [
|
||||||
"SAMBA_REALM", "SAMBA_DOMAIN", "SAMBA_HOSTNAME",
|
"SAMBA_REALM", "SAMBA_DOMAIN", "SAMBA_HOSTNAME",
|
||||||
"SAMBA_FQDN", "SAMBA_IP", "SAMBA_NETWORK",
|
"SAMBA_FQDN", "SAMBA_IP", "SAMBA_NETWORK",
|
||||||
"DNS_FORWARDER", "SAMBA_ADMIN_PASSWORD"
|
"DNS_FORWARDER", "SAMBA_ADMIN_PASSWORD"
|
||||||
]
|
]
|
||||||
|
|
||||||
# Env-Block ohne F-String-Klammern zusammenbauen, damit Gitea nicht stolpert
|
|
||||||
env_block_lines = []
|
env_block_lines = []
|
||||||
for key in env_keys:
|
for key in env_keys:
|
||||||
line = " " + key + ": ${" + key + "}"
|
line = " " + key + ": ${" + key + "}"
|
||||||
@@ -345,19 +345,40 @@ jobs:
|
|||||||
|
|
||||||
env_block_str = "\n".join(env_block_lines)
|
env_block_str = "\n".join(env_block_lines)
|
||||||
|
|
||||||
template_name = ".gitea/docker-compose.template" if os.path.exists(".gitea/docker-compose.template") else "docker-compose.template"
|
compose_template = ".gitea/docker-compose.template" if os.path.exists(".gitea/docker-compose.template") else "docker-compose.template"
|
||||||
|
if os.path.exists(compose_template):
|
||||||
with open(template_name, "r", encoding="utf-8") as f:
|
with open(compose_template, "r", encoding="utf-8") as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
content = content.replace("__REPO_NAME__", "samba-ad-dc")
|
content = content.replace("__REPO_NAME__", "samba-ad-dc")
|
||||||
content = content.replace("__FULL_URL__", "git.pi-farm.de/pi-farm/samba-ad-dc")
|
content = content.replace("__FULL_URL__", "git.pi-farm.de/pi-farm/samba-ad-dc")
|
||||||
content = content.replace("__BUILD_TAG__", os.environ.get("FINAL_TAG", "trixie"))
|
content = content.replace("__BUILD_TAG__", os.environ.get("FINAL_TAG", "trixie"))
|
||||||
content = content.replace("__ENV_BLOCK__", env_block_str)
|
content = content.replace("__ENV_BLOCK__", env_block_str)
|
||||||
|
|
||||||
with open("docker-compose.yml", "w", encoding="utf-8") as f:
|
with open("docker-compose.yml", "w", encoding="utf-8") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
print("docker-compose.yml erfolgreich generiert!")
|
print("✅ docker-compose.yml erfolgreich generiert!")
|
||||||
|
|
||||||
|
# 2. README.md aus rm.template generieren
|
||||||
|
readme_template = ".gitea/rm.template" if os.path.exists(".gitea/rm.template") else "rm.template"
|
||||||
|
if os.path.exists(readme_template):
|
||||||
|
with open(readme_template, "r", encoding="utf-8") as f:
|
||||||
|
rm_content = f.read()
|
||||||
|
|
||||||
|
# Hole die Beschreibung aus den Umgebungsvariablen (aus buildargs.env)
|
||||||
|
description = os.environ.get("DESCRIPTION", "Docker Image for samba-ad-dc")
|
||||||
|
|
||||||
|
# Platzhalter in der README ersetzen
|
||||||
|
rm_content = rm_content.replace("__BUILD_TAG__", os.environ.get("FINAL_TAG", "trixie"))
|
||||||
|
rm_content = rm_content.replace("__FULL_URL__", "git.pi-farm.de/pi-farm/samba-ad-dc")
|
||||||
|
rm_content = rm_content.replace("__DESCRIPTION__", description)
|
||||||
|
rm_content = rm_content.replace("__HISTORY_TABLE__", os.environ.get("HISTORY_CONTENT", ""))
|
||||||
|
rm_content = rm_content.replace("__DOCKER_RUN_BLOCK__", open("docker_run_block.txt", "r").read() if os.path.exists("docker_run_block.txt") else "")
|
||||||
|
|
||||||
|
with open("README.md", "w", encoding="utf-8") as f:
|
||||||
|
f.write(rm_content)
|
||||||
|
|
||||||
|
print("✅ README.md erfolgreich generiert!")
|
||||||
EOF
|
EOF
|
||||||
python3 update_script.py
|
python3 update_script.py
|
||||||
rm -f update_script.py
|
rm -f update_script.py
|
||||||
|
|||||||
Reference in new issue
Block a user