Skip to content

Commit

Permalink
chore: improving deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
twitchett committed Apr 16, 2017
1 parent 7be9172 commit 72b2ca5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,29 @@
# it's only awkward because github requires that all source files are in root.
# see: https://help.github.com/articles/generic-jekyll-build-failures/#source-setting

script="deploy"

# stash untracked
git stash save -u "stashing local modifications in preparation for deploy"
echo "$script: Saved local modifications"

# on master, remove all tracked files and then directories
git checkout master
# remove all git tracked files
git ls-files -z | xargs -0 rm -f
# remove all git tracked dirs
git ls-tree --name-only -d -r -z HEAD | sort -rz | xargs -0 rmdir
echo "$script: Cleaned master"

# now we have a clean branch
# copy across everything from source branch
git checkout source -- .
# copy the contents of /src to root
cp -a src/. .
# move src contents to root, delete src
mv src/* . && rm -r src
echo "$script: Prepared files for commit"

# add, commit, push
git add . && git commit -m "latest changes" && git push origin master
echo "$script: Pushed to master"

# restore working state
git checkout source git stash pop
echo "$script: Done!"

0 comments on commit 72b2ca5

Please sign in to comment.