Skip to content

Instantly share code, notes, and snippets.

@aziis98
Created September 14, 2020 15:02
Show Gist options
  • Select an option

  • Save aziis98/6401f86a89275c83e37f6c8388fde5b8 to your computer and use it in GitHub Desktop.

Select an option

Save aziis98/6401f86a89275c83e37f6c8388fde5b8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Colors
end="\033[0m"
black="\033[0;30m"
blackb="\033[1;30m"
white="\033[0;37m"
whiteb="\033[1;37m"
red="\033[0;31m"
redb="\033[1;31m"
green="\033[0;32m"
greenb="\033[1;32m"
yellow="\033[0;33m"
yellowb="\033[1;33m"
blue="\033[0;34m"
blueb="\033[1;34m"
purple="\033[0;35m"
purpleb="\033[1;35m"
lightblue="\033[0;36m"
lightblueb="\033[1;36m"
DEPLOY_DIR=public_html
GIT_REPO="https://github.com/aziis98/website-2020"
GIT_REPO_DIR=website-2020
echo -e "${yellow}[deploy-website]${end} Clearing old deploy directory: ${blue}${DEPLOY_DIR}${end}"
rm -rf $GIT_REPO_DIR/
echo -e "${yellow}[deploy-website]${end} Cloning ${lightblue}${GIT_REPO}${end} into ${blue}${GIT_REPO_DIR}${end}"
git clone $GIT_REPO $GIT_REPO_DIR
echo -e "${yellow}[deploy-website]${end} Copying ${blue}${GIT_REPO_DIR}/dist${end} directory into ${blue}${DEPLOY_DIR}${end}"
cp -r $GIT_REPO_DIR/dist/* $DEPLOY_DIR/
echo -e "${yellow}[deploy-website]${end} Appling base tag fix..."
echo -e "${yellow}[deploy-website]${end} ${red}- <base href=\"/\">${end}"
echo -e "${yellow}[deploy-website]${end} ${green}+ <base href=\"https://poisson.phc.dm.unipi.it/~delucreziis/\">${end}"
grep -lRZ '<base href="/">' $DEPLOY_DIR | xargs -0 -l sed -i -e 's/<base href="\/">/<base href="https:\/\/poisson.phc.dm.unipi.it\/~delucreziis\/">/'
echo -e "${yellow}[deploy-website]${end} Deploy finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment