From d3c141d2aae41295d3dc1f669fa3aaef45e9407e Mon Sep 17 00:00:00 2001 From: Songs2YT Date: Fri, 17 Jul 2026 02:13:33 +0200 Subject: [PATCH] Remove local publish helper from repo Co-authored-by: Cursor --- _push_gitea.py | 71 -------------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 _push_gitea.py diff --git a/_push_gitea.py b/_push_gitea.py deleted file mode 100644 index 9940235..0000000 --- a/_push_gitea.py +++ /dev/null @@ -1,71 +0,0 @@ -import os -import subprocess -from pathlib import Path - -repo = Path(r"C:\Development\Songs2YT") -token = os.environ["GITEA_TOKEN"] -remote = f"https://oauth2:{token}@git.atakanozban.com/Songs2YT/songs2yt.git" -safe_remote = "https://git.atakanozban.com/Songs2YT/songs2yt.git" - - -def run(args: list[str], check: bool = True) -> subprocess.CompletedProcess: - print(">>", " ".join(args), flush=True) - result = subprocess.run( - args, - cwd=repo, - capture_output=True, - text=True, - encoding="utf-8", - errors="replace", - ) - if result.stdout.strip(): - print(result.stdout.strip(), flush=True) - if result.stderr.strip(): - # redact token if somehow present - err = result.stderr.replace(token, "***") - print(err.strip(), flush=True) - if check and result.returncode != 0: - raise SystemExit(f"FAILED ({result.returncode})") - return result - - -os.chdir(repo) - -# Ensure gitignore covers secrets / junk -gi = repo / ".gitignore" -extra = [ - "*.tgz", - ".DS_Store", - "basibozuk_cover.jpg", - "bg-video/", - "scripts/", - "_restore/", -] -text = gi.read_text(encoding="utf-8") if gi.exists() else "" -for line in extra: - if line not in text: - text = text.rstrip() + "\n" + line + "\n" -gi.write_text(text, encoding="utf-8") - -run(["git", "init", "-b", "main"]) -run(["git", "config", "user.email", "songs2yt@atakanozban.com"]) -run(["git", "config", "user.name", "Songs2YT"]) -run(["git", "add", "-A"]) -run(["git", "status", "--short"]) -run( - [ - "git", - "commit", - "-m", - "Initial open-source self-hosted Songs2YT edition", - ] -) -run(["git", "remote", "remove", "origin"], check=False) -run(["git", "remote", "add", "origin", remote]) -# Push and set upstream -run(["git", "push", "-u", "origin", "main"]) -# Replace remote URL without token for local safety -run(["git", "remote", "set-url", "origin", safe_remote]) -run(["git", "remote", "-v"]) -run(["git", "log", "-1", "--oneline"]) -print("PUBLISH_OK", flush=True)