zkt25/sk1/prepare-app.sh

37 lines
1.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
set -e
# ─── GIT CONFIGURATION ───────────────────────────────────────────────
GIT_REMOTE_URL="https://af585fp_ftp:P32ubNLJPhnX_ftp@antonin.filippi.website.tuke.sk/plesk-git/exam-app"
BRANCH="master" # or "main" if thats your default branch
# ────────────────────────────────────────────────────────────────────
command -v git >/dev/null 2>&1 || { echo "Install git"; exit 1; }
echo "→ Initializing repository (if necessary)…"
if [ ! -d .git ]; then
git init
git checkout -b $BRANCH
fi
echo "→ Ensuring you are on branch $BRANCH"
git checkout $BRANCH
echo "→ Configuring remote 'tuke'…"
git remote remove tuke 2>/dev/null || true
git remote add tuke "$GIT_REMOTE_URL"
echo "→ Refreshing the index…"
# Add all files, including deleted ones
git add -A
echo "→ Committing changes if necessary…"
# The || true prevents an error if no changes are detected
git commit -m "Automatic deployment $(date '+%Y-%m-%d %H:%M:%S')" || echo "→ No changes to commit"
echo "→ Force pushing to Plesk ($BRANCH)…"
git push --force tuke $BRANCH:$BRANCH
echo "✅ Deployment complete!"
echo "→ Open: https://antonin.filippi.website.tuke.sk"