chore(gitea): add bootstrap-gitea-repo.sh for initial README commit
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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.
|
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.
|
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.
|
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
|
### Private Gitea token for players
|
||||||
|
|
||||||
|
|||||||
@@ -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)."
|
||||||
Reference in New Issue
Block a user