1 changed files with 28 additions and 8 deletions
@ -1,21 +1,41 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
|
|
||||||
|
# --- CONFIGURATION (Edit these for new environments) --- |
||||||
|
SERVER="newspapers2.islandarchives.ca" |
||||||
|
THEME_DIR="/var/www/islandnewspapers2/web/themes/custom/olivesnews" |
||||||
|
SITE_ROOT="/var/www/islandnewspapers2/web/sites/islandnewspapers2" |
||||||
|
DRUSH_PATH="/var/www/islandnewspapers2/vendor/drush/drush/drush" |
||||||
|
# -------------------------------------------------------- |
||||||
|
|
||||||
# 1. Check if a commit message was provided |
# 1. Check if a commit message was provided |
||||||
if [ -z "$1" ] |
if [ -z "$1" ]; then |
||||||
then |
echo "❌ Error: Please provide a commit message." |
||||||
echo "Error: Please provide a commit message." |
|
||||||
echo "Usage: ./deploy.sh 'Your message here'" |
echo "Usage: ./deploy.sh 'Your message here'" |
||||||
exit 1 |
exit 1 |
||||||
fi |
fi |
||||||
|
|
||||||
|
COMMIT_MSG="$1" |
||||||
|
|
||||||
|
echo "🚀 Starting deployment workflow..." |
||||||
|
|
||||||
# 2. Local Git workflow |
# 2. Local Git workflow |
||||||
|
echo "📦 Committing and pushing local changes..." |
||||||
git add --all |
git add --all |
||||||
git commit -m "$1" |
git commit -m "$COMMIT_MSG" |
||||||
git push # I added this because the server needs something to pull! |
git push |
||||||
|
|
||||||
# 3. Remote Server workflow |
# 3. Remote Server workflow |
||||||
# This runs the commands on the server and then closes the connection |
echo "🔗 Connecting to $SERVER..." |
||||||
ssh newspapers2.islandarchives.ca "cd /var/www/islandnewspapers2/web/themes/custom/olivesnews && git pull && cd /var/www/islandnewspapers2/web/sites/islandnewspapers2 && /var/www/islandnewspapers2/vendor/drush/drush/drush cr" |
|
||||||
|
|
||||||
|
# We wrap the remote commands in a single string for SSH |
||||||
|
# The '&&' ensures that if one step fails, the script stops immediately. |
||||||
|
ssh "$SERVER" " |
||||||
|
echo '📥 Pulling code into theme folder...' && \ |
||||||
|
cd $THEME_DIR && \ |
||||||
|
git pull && \ |
||||||
|
echo '🧹 Rebuilding Drupal cache...' && \ |
||||||
|
cd $SITE_ROOT && \ |
||||||
|
$DRUSH_PATH cr |
||||||
|
" |
||||||
|
|
||||||
echo "Done! Deployment successful." |
echo "✅ Done! Deployment successful." |
||||||
|
|||||||
Loading…
Reference in new issue