From b37677cbc1e43002c9a4ef5aab6f9cedf9a1b724 Mon Sep 17 00:00:00 2001 From: ckoch Date: Mon, 20 Jul 2026 20:21:52 -0400 Subject: [PATCH] Add GitHub publish script Co-Authored-By: Claude Opus 4.8 --- tools/publish.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 tools/publish.sh diff --git a/tools/publish.sh b/tools/publish.sh new file mode 100755 index 0000000..f882d23 --- /dev/null +++ b/tools/publish.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# One-shot publish to GitHub. Run AFTER authenticating gh (see below). +# +# Auth options (pick one): +# export GH_TOKEN=ghp_xxx # a token with 'repo' + 'workflow' scope +# gh auth login # interactive +# +# Usage: +# ./tools/publish.sh [REPO_NAME] [--private] +# (defaults: repo name "GB4-UltraWide-Fix", public) +set -euo pipefail +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"; cd "$HERE" + +REPO="${1:-GB4-UltraWide-Fix}" +VIS="--public"; [ "${2:-}" = "--private" ] && VIS="--private" +TAG="v1.0.0" + +command -v gh >/dev/null || { echo "[!] gh not installed"; exit 1; } +gh auth status >/dev/null 2>&1 || { echo "[!] Not authenticated. Set GH_TOKEN or run 'gh auth login'."; exit 1; } +OWNER="$(gh api user -q .login)" +echo "[+] Publishing as: $OWNER repo: $REPO $VIS" + +# 1. build the release artifact fresh +bash tools/build_release.sh >/dev/null +echo "[+] Built dist/GB4_UltraWide_Fix.zip" + +# 2. create the repo (skip if it already exists) and set as origin +if gh repo view "$OWNER/$REPO" >/dev/null 2>&1; then + echo "[i] Repo exists; reusing." + git remote get-url origin >/dev/null 2>&1 || git remote add origin "https://github.com/$OWNER/$REPO.git" +else + gh repo create "$OWNER/$REPO" $VIS --source=. --remote=origin \ + --description="UltraWide (32:9/21:9) fix for Gundam Breaker 4 — Hor+ FOV via SUWSF. Proton-ready." +fi + +# 3. push branch + tag +git push -u origin main +git push origin "$TAG" + +# 4. create the release with notes + zip asset (idempotent) +if gh release view "$TAG" -R "$OWNER/$REPO" >/dev/null 2>&1; then + gh release upload "$TAG" dist/GB4_UltraWide_Fix.zip -R "$OWNER/$REPO" --clobber +else + gh release create "$TAG" dist/GB4_UltraWide_Fix.zip \ + -R "$OWNER/$REPO" -t "GB4 UltraWide Fix $TAG" -F RELEASE_NOTES.md +fi + +echo +echo "[+] Done: https://github.com/$OWNER/$REPO/releases/tag/$TAG"