45 lines
1002 B
Bash
45 lines
1002 B
Bash
#!/bin/bash
|
|
|
|
# Load config file
|
|
source ./config.env
|
|
|
|
|
|
# Repository URL
|
|
REPO_URL=$API_REPO
|
|
REPO_DIR=$API_REPO_DIR
|
|
#set branch Name
|
|
BRANCH_NAME=$API_BRANCH_NAME
|
|
|
|
|
|
# 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"
|
|
echo "---------------------------------------------"
|
|
echo "Copying appsetting"
|
|
|
|
|
|
cd ..
|
|
SOURCE_FILE="./appsettings.Production.json"
|
|
TARGET_DIR="./marco.pms.api/Marco.Pms.Services/"
|
|
cp "$SOURCE_FILE" "$TARGET_DIR"
|
|
#cp "./appsettings.Production.json" "./marco.pms.api/Marco.Pms.Services/"
|
|
|
|
echo "Successfully copied appsetting to $TARGET_DIR"
|
|
|