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 | |
| 13 | set -euo pipefail |
| 14 | |
| 15 | KONNOS_URL="${BRIVEN_KONNOS_URL:-https://code.konnos.org/flndrn/Briven.git}" |
| 16 | ARG="${1:-main}" |
| 17 | |
| 18 | if [[ "$ARG" == "setup" ]]; then |
| 19 | DO_PUSH=0 |
| 20 | BRANCH="main" |
| 21 | else |
| 22 | DO_PUSH=1 |
| 23 | BRANCH="$ARG" |
| 24 | fi |
| 25 | |
| 26 | # origin = Konnos only (fetch + push). No GitHub dual-push. |
| 27 | if 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 |
| 32 | else |
| 33 | git remote add origin "$KONNOS_URL" |
| 34 | fi |
| 35 | |
| 36 | # Keep named konnos remote as alias |
| 37 | if git remote get-url konnos >/dev/null 2>&1; then |
| 38 | git remote set-url konnos "$KONNOS_URL" |
| 39 | else |
| 40 | git remote add konnos "$KONNOS_URL" |
| 41 | fi |
| 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 | |
| 46 | echo "origin fetch: $(git remote get-url origin)" |
| 47 | echo "origin push: $(git remote get-url --push origin 2>/dev/null || git remote get-url origin)" |
| 48 | echo "konnos: $(git remote get-url konnos)" |
| 49 | |
| 50 | if [[ "$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." |
| 54 | fi |