Skip to content

Instantly share code, notes, and snippets.

@abdus
Last active April 13, 2020 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdus/e5df31cfdf40a0542f1731599936a3a9 to your computer and use it in GitHub Desktop.
Save abdus/e5df31cfdf40a0542f1731599936a3a9 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Stage and Commit Every Unsaved changes
# and push them to master
git add .
git commit -m 'comitted from deploy script'
git push origin master
# generate a clean build
bundle exec jekyll clean
bundle exec jekyll doctor
bundle exec jekyll build
# create and Checkout to gh-pages
git checkout gh-pages
# delete everything except _site
for dir in *; do
[ "$dir" = "_site" ] && continue
rm -rf "$dir"
done
# delete dotfiles
for dir in .*; do
[ "$dir" = ".git" ] && continue
rm -rf "$dir"
done
# move files from _site to .
mv _site/* ./
# Commit everything in gh-pages
git add .
git commit -m 'Deployed'
git push origin gh-pages
# check back to master and run `bundle install`
git checkout master
bundle install
echo \n\n\n
echo ...............................................................
echo ...................... Deployed ......................
echo ...............................................................
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment