This is a middlemann website that compiles into static web pages to be hosted on github pages.
Since this site is utilizing Githubs user pages I needed to find a way to work incrementally and only deploy my code when something was finished. The other aspect of this was that the static site gets exported into a build directory(bottom of page).
To accomplish this I did several things.
- Changed your default branch from
master
to a new development branch. I named minesource
.
$ git branch source
$ git push -u origin source
- In your
/Gemfile
add middleman-deploy. I decided on this one because it seems to be the most maintained over other gems as well as great documentation.
# helps deploy to master branch
gem 'middleman-deploy', '~> 0.3.0'
- Configure your middleman-deploy gem by adding the
activate
block to yourconfig.rb
file..branch
will be set tomaster
so that github pages will use those built files for displaying my website.
activate :deploy do |deploy|
deploy.method = :git
deploy.branch = 'master'
deploy.commit_message = 'initial build for middleman conversion'
end
Please note, I plan on changing the commit_message with most deploys as I'd like to make my builds descriptive. You can omit this if you want to have the default message commit message made for you.
It's rather simple to build the changes to your site thanks to the middleman-deploy gem. In your terminal type:
$ middleman deploy --build-before
I decided to use the --build-before
option so that it's one step to essentially push my changes to my master
branch.
If you have any questions or comments you can reach me at: [email protected]