36 lines
1.2 KiB
Bash
Executable File
36 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# push-to-origin.sh — Zero-ambiguity remote configuration & first push helper
|
|
# Usage:
|
|
# ./push-to-origin.sh <REMOTE_GIT_URL>
|
|
# or: ORIGIN_URL="https://github.com/<user>/encyclopedia-knowledge-graph.git" ./push-to-origin.sh
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REMOTE_URL="${1:-${ORIGIN_URL:-}}"
|
|
|
|
if [[ -z "${REMOTE_URL}" ]]; then
|
|
echo "Usage: $0 <remote-git-url>"
|
|
echo "Example (HTTPS): $0 https://github.com/<org>/encyclopedia-knowledge-graph.git"
|
|
echo "Example (SSH): $0 git@github.com:<org>/encyclopedia-knowledge-graph.git"
|
|
exit 1
|
|
fi
|
|
|
|
cd "${REPO_DIR}"
|
|
|
|
if git remote get-url origin >/dev/null 2>&1; then
|
|
echo "[info] Updating existing remote 'origin' -> ${REMOTE_URL}"
|
|
git remote set-url origin "${REMOTE_URL}"
|
|
else
|
|
echo "[info] Adding remote 'origin' -> ${REMOTE_URL}"
|
|
git remote add origin "${REMOTE_URL}"
|
|
fi
|
|
|
|
echo "[info] Verifying 6-gate Knowledge Graph integrity & upstream Glossary isolation before push..."
|
|
python3 "${REPO_DIR}/scripts/build_encyclopedia_knowledge_graph.py" --verify-only
|
|
|
|
echo "[info] Pushing branch 'main' and tag 'v1.0.0' to origin..."
|
|
git push -u origin main
|
|
git push origin v1.0.0
|
|
echo "[ok] First push to ${REMOTE_URL} complete."
|