Skip to content

Instantly share code, notes, and snippets.

@maximebf
Created February 5, 2012 22:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maximebf/1748208 to your computer and use it in GitHub Desktop.
Save maximebf/1748208 to your computer and use it in GitHub Desktop.
Fabfile to deploy a jekyll site
from fabric.api import task, run, env, execute, local, put, lcd
env.site_path = '/tmp/jekyll-site'
env.tar_filename = env.site_path + '.tar.bz2'
env.remote_site_path = '~/public_html'
@task
def build():
local("jekyll %s" % env.site_path)
with lcd(env.site_path):
local('tar cjf %s *' % env.tar_filename)
local("rm -r %s" % env.site_path)
@task
def push():
run('mkdir -p %s' % env.remote_site_path)
put(env.tar_filename, env.tar_filename)
run('tar xjf %s -C %s' % (env.tar_filename, env.remote_site_path))
run('rm %s' % env.tar_filename)
@task
def deploy():
execute(build)
execute(push)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment