forked from wouterj/wouterj.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the build script from the publication on Travis
This allows running the publication only for branch pushes and not for pull requests. The creation of the orphan commit for the master branch with the built website has been refactored to avoid having to filtering the branch each time, which is faster. The new script also avoids changing the git email and username globally, making it much safer to run the publish task locally (through bldr for instance).
- Loading branch information
Showing
3 changed files
with
27 additions
and
16 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env sh | ||
# make the script fail for any failed command | ||
set -e | ||
# make the script display the commands it runs to help debugging failures | ||
set -x | ||
|
||
# build site | ||
sass source/css/wouterj.scss:source/css/wouterj.css --style compressed --no-cache | ||
./vendor/bin/sculpin generate --env prod | ||
touch output_prod/.nojekyll |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
#!/usr/bin/env sh | ||
# make the script fail for any failed command | ||
set -e | ||
# make the script display the commands it runs to help debugging failures | ||
set -x | ||
|
||
# configure env | ||
git config --global user.email '[email protected]' | ||
git config --global user.name 'WouterJ.nl bot' | ||
# Go to the output directory | ||
cd output_prod | ||
|
||
# checkout publish branch | ||
if [ "`git show-ref --heads master`" ]; then | ||
git branch -D master | ||
# Remove the existing repo if it exists | ||
if [ -d ".git" ]; then | ||
rm -rf .git | ||
fi | ||
git checkout -b master | ||
|
||
# build site | ||
sass source/css/wouterj.scss:source/css/wouterj.css --style compressed --no-cache | ||
./vendor/bin/sculpin generate --env prod | ||
touch output_prod/.nojekyll | ||
# Create a repo for the built website for the master branch | ||
git init | ||
|
||
# configure env (locally) | ||
git config user.email '[email protected]' | ||
git config user.name 'WouterJ.nl bot' | ||
|
||
# commit build | ||
git add -f output_prod | ||
git add . | ||
git commit -m "Build website" | ||
|
||
# only push output | ||
git filter-branch --subdirectory-filter output_prod/ -f | ||
|
||
# push to GitHub Pages | ||
git push "https://github.com/WouterJ/wouterj.github.com" -f master |