From 75e3b594429da2c710cba54a0ea4a27a63c60f5a Mon Sep 17 00:00:00 2001 From: Docker Build Date: Sun, 10 May 2026 15:29:07 -0500 Subject: [PATCH] chore(gitea): add bootstrap-gitea-repo.sh for initial README commit Co-authored-by: Cursor --- tools/fractured-launcher-electron/README.md | 2 +- .../scripts/bootstrap-gitea-repo.sh | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100755 tools/fractured-launcher-electron/scripts/bootstrap-gitea-repo.sh diff --git a/tools/fractured-launcher-electron/README.md b/tools/fractured-launcher-electron/README.md index 77faec3..08916fd 100644 --- a/tools/fractured-launcher-electron/README.md +++ b/tools/fractured-launcher-electron/README.md @@ -103,7 +103,7 @@ CI workflow **Sync release to Gitea** (`.github/workflows/gitea-release-sync.yml 4. **Repo name guard** — Jobs use `if: github.repository == 'Dawnforger/Fractured'`. Forks or renames must change that line or runs are skipped. 5. **Secrets** — **`GITEA_BASE_URL`**, **`GITEA_TOKEN`**, **`GITEA_OWNER`**, **`GITEA_REPO`** must be set under **Settings → Secrets and variables → Actions**. A failed “Upload to Gitea” step usually prints which is missing. 6. **Actions tab** — Open the latest **Sync release to Gitea** run; a red **build-electron** (old tag without `package-lock.json`, etc.) or **Upload to Gitea** step shows the real error. -7. **HTTP 422 `repo is empty`** — The Gitea repo has **no commits** yet. Push any initial commit (e.g. **Add README** in the Gitea web UI, or `git push` to **`main`**). Optionally set **`GITEA_TARGET_REF`** to match your real default branch if it is not **`main`**. +7. **HTTP 422 `repo is empty`** — The Gitea repo has **no commits** yet. Push any initial commit (e.g. **Add README** in the Gitea web UI, or `git push` to **`main`**). Optionally set **`GITEA_TARGET_REF`** to match your real default branch if it is not **`main`**. From this repo you can run **`scripts/bootstrap-gitea-repo.sh`** (see script header for `GITEA_*` env or pass the HTTPS/SSH clone URL as the first argument). ### Private Gitea token for players diff --git a/tools/fractured-launcher-electron/scripts/bootstrap-gitea-repo.sh b/tools/fractured-launcher-electron/scripts/bootstrap-gitea-repo.sh new file mode 100755 index 0000000..4852a10 --- /dev/null +++ b/tools/fractured-launcher-electron/scripts/bootstrap-gitea-repo.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Push a one-file README so the Gitea repo is non-empty (fixes HTTP 422 "repo is empty" +# when CI creates a release). Safe to re-run only if the repo still has no commits; +# if it already has history, skip or use the Gitea web UI instead. +# +# Usage: +# export GITEA_BASE_URL=https://git.example.com +# export GITEA_OWNER=myorg +# export GITEA_REPO=fractured-patches +# ./bootstrap-gitea-repo.sh +# +# Or pass an explicit clone URL (HTTPS or SSH): +# ./bootstrap-gitea-repo.sh https://git.example.com/myorg/fractured-patches.git +# +set -euo pipefail + +BRANCH="${GITEA_TARGET_REF:-main}" + +if [ "${1:-}" != "" ]; then + URL="$1" +else + : "${GITEA_BASE_URL:?Set GITEA_BASE_URL or pass clone URL as first argument}" + : "${GITEA_OWNER:?Set GITEA_OWNER or pass clone URL as first argument}" + : "${GITEA_REPO:?Set GITEA_REPO or pass clone URL as first argument}" + BASE="${GITEA_BASE_URL%/}" + URL="${BASE}/${GITEA_OWNER}/${GITEA_REPO}.git" +fi + +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT +cd "$TMP" + +git init -q +git checkout -q -b "$BRANCH" + +cat >README.md <<'EOF' +# Fractured release mirror + +Release assets (launcher builds, patches, `patch-manifest.json`, etc.) are uploaded here by **GitHub Actions** (“Sync release to Gitea”) from the main Fractured repository. + +This initial commit exists because **Gitea requires at least one commit** in the repository before releases can be created. +EOF + +git add README.md +git commit -q -m "chore: initial commit (required for Gitea releases)" + +git remote add origin "$URL" +git push -u origin "$BRANCH" + +echo "Pushed initial README to $URL (branch $BRANCH)."