#!/usr/bin/env bash # Create isaacclad/ladill-transfer on Gitea and push main. set -Eeuo pipefail GITEA_API="${GITEA_API:-http://161.97.138.149:3000/api/v1}" REPO_OWNER="${GITEA_OWNER:-isaacclad}" REPO_NAME="${GITEA_REPO:-ladill-transfer}" ROOT="$(cd "$(dirname "$0")/.." && pwd)" if [ -z "${GITEA_TOKEN:-}" ]; then echo "Set GITEA_TOKEN to a Gitea personal access token with write:repository scope." >&2 echo "Create one at: ${GITEA_API%/api/v1}/user/settings/applications" >&2 exit 1 fi echo "==> Creating ${REPO_OWNER}/${REPO_NAME} on Gitea" curl -fsS -X POST "${GITEA_API}/user/repos" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"name\":\"${REPO_NAME}\",\"private\":false,\"auto_init\":false}" \ | head -c 200 echo cd "$ROOT" if ! git remote get-url origin >/dev/null 2>&1; then git remote add origin "ladill-gitea:${REPO_OWNER}/${REPO_NAME}.git" fi echo "==> Pushing main" GIT_SSH_COMMAND="ssh -o BatchMode=yes" git push -u origin main echo "==> Done. Deploy workflow will run on the Gitea Actions runner (label: deploy)."