#!/usr/bin/env bash
# Push to Gitea using deploy/nexus-1panel.secrets.sh (not committed).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
SECRETS="${ROOT}/deploy/nexus-1panel.secrets.sh"
if [[ -f "$SECRETS" ]]; then
  # shellcheck disable=SC1090
  source "$SECRETS"
fi
HOST="${NEXUS_GITEA_HOST:-66.154.115.8:3000}"
REPO="${NEXUS_GITEA_REPO:-admin/Nexus.git}"
TOKEN="${NEXUS_GITEA_TOKEN:?缺少 NEXUS_GITEA_TOKEN，请配置 $SECRETS}"
BRANCH="${1:-main}"
GIT_TERMINAL_PROMPT=0 git -C "$ROOT" push "http://admin:${TOKEN}@${HOST}/${REPO}" "$BRANCH"
