git-push-konnos.sh54 lines · main
1#!/usr/bin/env bash
2# Push Briven main → Konnos ONLY (no GitHub).
3#
4# Dokploy auto-deploy for briven-france is wired to:
5# https://code.konnos.org/flndrn/Briven.git (customGit)
6# so production rebuilds from Konnos pushes, not GitHub.
7#
8# Usage:
9# ./scripts/git-push-konnos.sh setup # configure remotes only
10# ./scripts/git-push-konnos.sh # configure + push main
11# ./scripts/git-push-konnos.sh main # configure + push that branch
12
13set -euo pipefail
14
15KONNOS_URL="${BRIVEN_KONNOS_URL:-https://code.konnos.org/flndrn/Briven.git}"
16ARG="${1:-main}"
17
18if [[ "$ARG" == "setup" ]]; then
19 DO_PUSH=0
20 BRANCH="main"
21else
22 DO_PUSH=1
23 BRANCH="$ARG"
24fi
25
26# origin = Konnos only (fetch + push). No GitHub dual-push.
27if git remote get-url origin >/dev/null 2>&1; then
28 git remote set-url origin "$KONNOS_URL"
29 # Drop any extra push URLs (old dual-push config)
30 # re-set single push URL
31 git remote set-url --push origin "$KONNOS_URL" 2>/dev/null || true
32else
33 git remote add origin "$KONNOS_URL"
34fi
35
36# Keep named konnos remote as alias
37if git remote get-url konnos >/dev/null 2>&1; then
38 git remote set-url konnos "$KONNOS_URL"
39else
40 git remote add konnos "$KONNOS_URL"
41fi
42
43# Remove accidental github-only remote if present as separate name
44# (do not delete "github" if user has one; only clean dual-push on origin)
45
46echo "origin fetch: $(git remote get-url origin)"
47echo "origin push: $(git remote get-url --push origin 2>/dev/null || git remote get-url origin)"
48echo "konnos: $(git remote get-url konnos)"
49
50if [[ "$DO_PUSH" -eq 1 ]]; then
51 echo "Pushing '${BRANCH}' → Konnos only (code.konnos.org)…"
52 git push -u origin "$BRANCH"
53 echo "Done. Konnos is source of truth. Dokploy should auto-deploy if webhook/autoDeploy is on."
54fi