Add GitHub publish script
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Executable
+49
@@ -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"
|
||||||
Reference in New Issue
Block a user