75e3b59442
Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.6 KiB
Bash
Executable File
51 lines
1.6 KiB
Bash
Executable File
#!/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)."
|