37 lines
1.3 KiB
Bash
37 lines
1.3 KiB
Bash
#!/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"
|
|
# ────────────────────────────────────────────────────────────────────
|
|
|
|
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"
|