diff --git a/deploy.sh b/deploy.sh index 5780534..0efa8b7 100755 --- a/deploy.sh +++ b/deploy.sh @@ -12,6 +12,10 @@ ENV=${1:-test} APP_NAME="ca-grow-ops-manager" REPO_URL="https://git.runfoo.run/malty/ca-grow-ops-manager.git" +# Get current branch +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) +BRANCH=${2:-$CURRENT_BRANCH} # Allow override or use current + # Define Environment Variables case "$ENV" in test) @@ -28,6 +32,13 @@ case "$ENV" in PORT="8010" ENV_DISPLAY="🔴 PROD (Tangible-Aacorn)" ;; + preview) + HOST="nexus-vector" + USER="admin" + DEPLOY_PATH="/srv/containers/veridian-preview" + PORT="8012" + ENV_DISPLAY="🟣 PREVIEW (Veridian-Preview on Nexus-Vector)" + ;; *) echo "Error: Unknown environment '$ENV'. Use 'test' or 'prod'." exit 1 @@ -70,7 +81,7 @@ echo "" # Step 2: Push to Forgejo (Local) echo -e "${BLUE}Step 2: Pushing code to Forgejo...${NC}" -git push origin main +git push origin $BRANCH echo -e "${GREEN}✓ Code pushed${NC}" echo "" @@ -88,7 +99,7 @@ ssh "$USER@$HOST" " git clone $REPO_URL $DEPLOY_PATH else echo ' Pulling latest changes...' - cd $DEPLOY_PATH && git pull origin main + cd $DEPLOY_PATH && git fetch origin && git checkout $BRANCH && git pull origin $BRANCH fi " echo -e "${GREEN}✓ Code synced${NC}"