Created
October 28, 2015 16:19
-
-
Save adamsrog/e4e5e4d0267e53264e4d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will go through each directory (excluding .git/ and ./) and run `jekyll build`, | |
# then deploy it to specified account contained in the .username file. It is assumed the scp | |
# connection is able to connect using a key pair. | |
# Get count of sites to build | |
sites=$(find . -type directory -maxdepth 1 | grep -v .git | sed -n '1!p' | wc -l) | |
echo "[i] Depolying Jekyll Sites: $sites" | |
echo "---------------------------------------------------------" | |
for d in $(find . -type directory -maxdepth 1 | grep -v .git | sed -n '1!p') | |
do | |
# Build the site | |
echo -n "[.] Processing $d... " | |
( cd $d && jekyll build ) | grep "Error"; | |
echo "done." | |
# Deploy the site using scp | |
filename=$d/.username | |
while read -r line | |
do | |
name=$line | |
echo -n "[.] Deploying $d/_site as $name... " | |
(cd $d/_site && scp -r -q * $name@ntsi:public_html) | |
echo "[!] $name complete. Finished with code: $?" | |
echo "---------------------------------------------------------" | |
done < "$filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample output