32 lines
703 B
Bash
32 lines
703 B
Bash
#!/bin/bash
|
|
|
|
# Load config file
|
|
source ./config.env
|
|
|
|
|
|
#set branch Name
|
|
BRANCH_NAME=$WEB_BRANCH_NAME
|
|
|
|
# Repository URL
|
|
REPO_URL="https://git.marcoaiot.com/admin/marco.pms.web.git"
|
|
REPO_DIR="marco.pms.web"
|
|
|
|
# Step 1: Clone the GitHub repository (use the branch defined)
|
|
if [ -d "$REPO_DIR" ]; then
|
|
echo "Repository already exists. Pulling latest changes from branch $BRANCH_NAME..."
|
|
cd "$REPO_DIR" || exist 1
|
|
|
|
# ensure we are on correct branch
|
|
git fetch origin
|
|
git checkout "$BRANCH_NAME"
|
|
git pull origin "$BRANCH_NAME"
|
|
|
|
else
|
|
echo "Cloning the Git repository from branch $BRANCH_NAME..."
|
|
git clone -b "$BRANCH_NAME" "$REPO_URL"
|
|
cd "$REPO_DIR" || exit 1
|
|
|
|
fi
|
|
|
|
echo "Successfully pull $BRANCH_NAME"
|