chore: Update deployment script for preview env
This commit is contained in:
parent
63d0e4ee2d
commit
da32c67300
1 changed files with 13 additions and 2 deletions
15
deploy.sh
15
deploy.sh
|
|
@ -12,6 +12,10 @@ ENV=${1:-test}
|
||||||
APP_NAME="ca-grow-ops-manager"
|
APP_NAME="ca-grow-ops-manager"
|
||||||
REPO_URL="https://git.runfoo.run/malty/ca-grow-ops-manager.git"
|
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
|
# Define Environment Variables
|
||||||
case "$ENV" in
|
case "$ENV" in
|
||||||
test)
|
test)
|
||||||
|
|
@ -28,6 +32,13 @@ case "$ENV" in
|
||||||
PORT="8010"
|
PORT="8010"
|
||||||
ENV_DISPLAY="🔴 PROD (Tangible-Aacorn)"
|
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'."
|
echo "Error: Unknown environment '$ENV'. Use 'test' or 'prod'."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -70,7 +81,7 @@ echo ""
|
||||||
|
|
||||||
# Step 2: Push to Forgejo (Local)
|
# Step 2: Push to Forgejo (Local)
|
||||||
echo -e "${BLUE}Step 2: Pushing code to Forgejo...${NC}"
|
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 -e "${GREEN}✓ Code pushed${NC}"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
|
@ -88,7 +99,7 @@ ssh "$USER@$HOST" "
|
||||||
git clone $REPO_URL $DEPLOY_PATH
|
git clone $REPO_URL $DEPLOY_PATH
|
||||||
else
|
else
|
||||||
echo ' Pulling latest changes...'
|
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
|
fi
|
||||||
"
|
"
|
||||||
echo -e "${GREEN}✓ Code synced${NC}"
|
echo -e "${GREEN}✓ Code synced${NC}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue