ia_dev/deploy/change-to-all-branches.sh
Nicolas Cantu 07e0341c1d Initial commit: ia_dev pilot repo, agents and deploy scripts
**Motivations:**
- Provide a single repo for IA-driven piloting of all projects (agents, rules, deploy scripts).
- Reusable as git submodule; project-specific config in projects/ (no slug from submodule path).

**Evolutions:**
- Cursor agents: deploy-by-script, push-by-script, branch-align, fix, evol, fix-lint, fix-search, code, docupdate, gitea-issues-process, change-to-all-branches.
- Deploy scripts: pousse.sh (build_dirs from project config), bump-version.sh (version from project config), branch-align.sh, change-to-all-branches.sh.
- Project config schema in projects/README.md; lecoffreio.json as example.

**Pages affectées:**
- .cursor/agents/*.md, .cursor/rules/*.mdc, deploy/*.sh, projects/README.md, projects/lecoffreio.json, README.md, CLAUDE.md, config files.
2026-03-12 21:44:29 +01:00

30 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# From branch test only: align origin/test, origin/pprod, origin/prod then deploy to test (import-v1, skipSetupHost).
# Use when you have already pushed to test and want to sync other branches and deploy test in one go.
set -euo pipefail
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "[change-to-all-branches][ERROR] Not in a git repository" >&2
exit 1
fi
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
DEPLOY_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
if [[ "$(pwd)" != "$PROJECT_ROOT" ]]; then
cd "$PROJECT_ROOT" && exec "${DEPLOY_DIR}/$(basename "${BASH_SOURCE[0]:-$0}")" "$@"
fi
current="$(git rev-parse --abbrev-ref HEAD)"
if [[ "$current" != "test" ]]; then
echo "[change-to-all-branches][ERROR] Must be on branch 'test' (current: '${current}')" >&2
exit 1
fi
echo "[change-to-all-branches] Aligning branches..."
"$DEPLOY_DIR/branch-align.sh" test
echo "[change-to-all-branches] Deploying test (--import-v1 --skipSetupHost, --no-sync-origin because we just pushed)..."
"$DEPLOY_DIR/scripts_v2/deploy.sh" test --import-v1 --skipSetupHost --no-sync-origin
echo "[change-to-all-branches] OK"