Makzan / I share what I learned

Periodically deploying Middleman static site

The new makzan.net is built on top of Middleman static site generator. Then I deploy the site as a Github pages.

I use middleman-deploy gem to setup the Github pages deployment, which I follow their default setting:

1
2
3
4
activate :deploy do |deploy|
  deploy.build_before = true
  deploy.method = :git
end

I use Cloud9 for development and run the following cron job hourly.

1
5 * * * * /project_path/build_and_deploy.sh > /project_path/cron.log 2>&1

In which, the build_and_deploy.sh executes the middleman deploycommand under the project folder.

1
2
3
4
5
6
7
8
!/usr/bin/env bash

source /usr/local/rvm/environments/ruby-2.2.1
source /home/ubuntu/.nvm/nvm.sh

cd /project_path

middleman deploy

The source is to make the rvm and node environment works from the cron environment.


Published on 2015-09-19. More articles like this:
- Web Technologies

Previous <- Configure files to copy without middleman building process
Next -> Have a well defined done state

Want productive tips and web technologies links like this in your inbox each week? Sign up for weekly dispatch each week. No spam ever. Just useful content: