zero's a life

An extra chance.

Automating Blog Deployment With Octopress

| Comments

Based on Kevin van Zonneveld’s (@kvz) article on setting up Octopress, I’ve adapted a Makefile to make building my blog easier… with make. The following Makefile allows me to build and deploy my blog by typing make blog at the command prompt.

all: blog

preview:
        bundle exec rake generate && bundle exec rake preview

blog:
        git pull && \
        bundle install && \
        bundle exec rake integrate && \
        bundle exec rake generate && \
        bundle exec rake deploy && \
        git add .; \
        git commit -am "blog update $$(date +%Y-%m-%d)"; \
        git push origin source

.PHONY: blog                   # Force blog to run regardless of the changes to the files.

Additional Notes

rake build didn’t work for me

I think this is because I haven’t written any tasks that use rake build.

Remote for the source of my blog

I push the source code of my blog to a branch named source rather than master.

The percent symbol screwed everything up

Not sure exactly why, but including the % after blog on the line .PHONY: blog% gave me an error saying make: `blog' is up to date.. Removing the % allowed me to run make blog as expected.

Comments