htmldeploy/push.sh

30 lines
850 B
Bash
Raw Normal View History

2025-05-16 10:11:11 +00:00
ONFIGURATION =====
REPO_URL="http://157.66.191.31:3000/risadmin_prod/htmldeploy.git"
REPO_DIR="common"
NEW_BRANCH="<your_new_branch_name>" # Replace this or inject dynamically
COMMIT_MSG="Auto commit to $NEW_BRANCH at $(date)"
# ===== STEP 1: CLONE THE REPO =====
if [ -d "$REPO_DIR" ]; then
echo "Directory '$REPO_DIR' already exists. Deleting it..."
rm -rf "$REPO_DIR"
fi
echo "Cloning repository..."
git clone "$REPO_URL"
# ===== STEP 2: CREATE AND SWITCH TO NEW BRANCH =====
cd "$REPO_DIR" || exit 1
git checkout -b "$NEW_BRANCH"
# ===== STEP 3: COPY FILES (optional) =====
# Example: If your files are in /data/html_files
# cp /data/html_files/*.html .
# ===== STEP 4: COMMIT AND PUSH =====
git add .
git commit -m "$COMMIT_MSG" || echo "Nothing to commit"
git push origin "$NEW_BRANCH"
echo "Code pushed to branch '$NEW_BRANCH'"