release-scripts/prod/pull-client.sh

32 lines
659 B
Bash

#!/bin/bash
# Load config file
source ./config.env
#set branch Name
BRANCH_NAME=$WEB_BRANCH_NAME
# Repository URL
REPO_URL=$WEB_REPO
REPO_DIR=$WEB_REPO_DIR
# 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"