Created
March 21, 2014 08:32
-
-
Save punkstar/9682012 to your computer and use it in GitHub Desktop.
DeployHQ steps to deploy a jekyll site
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
# We build everything in a staging directory, so we don't take the site down during a deployment. | |
rm -rf %path%/../staging/ && mkdir %path%/../staging/ | |
# Perform the actual jekyll build, constants are for encoding issues (I think, can't remember) | |
source ~/.bashrc && cd %path% && LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 jekyll | |
# Build the sass files, so we don't need to keep the css in our repo | |
source ~/.bashrc && cd %path%/../staging/ && LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 && sass --update . | |
# Copy our .htaccess across | |
cp %path%/.htaccess %path%/../staging/ | |
# I use variables in my jekyll templates that I'd like to update on deployment. This could do | |
# with some optimisation | |
find %path%/../staging/ -type f | xargs -I {} bash -l -c 'sed -e "s/\$DATE/`date`/g" {} > {}.tmp && mv {}.tmp {}' && | |
find %path%/../staging/ -type f | xargs -I {} bash -l -c 'sed -e "s/\$COUNT/%count%/g" {} > {}.tmp && mv {}.tmp {}' | |
# Finally, we change the staging directory to the live directory, and a keep a backup of our old live directory. | |
mv %path%/../public %path%/../public.deleted && mv %path%/../staging/ %path%/../public && rm -rf %path%/../public.deleted |
Author
punkstar
commented
Mar 21, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment