No commit activity in last 3 years
No release in over 3 years
Adds S3 deploy and Cloudfront invalidation support to the Middleman build toolchain
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.8.0
~> 0.6.1
~> 0.12.0
~> 0.4.0
 Project Readme

Middleman AWS Deploy

Deploys build files to S3 at the end of the Middleman build toolchain, and/or invalidates Cloudfront.

In your config.rb file, add.

configure :build do
  # ...
  if ENV.include?('DEPLOY')
    activate :s3_deploy do |s3|
      s3.access_key_id = ENV['AWS_ACCESS_KEY_ID']
      s3.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
      s3.bucket = ENV['AWS_S3_BUCKET']
    end
    activate :invalidate_cloudfront do |cf|
      cf.access_key_id = ENV['AWS_ACCESS_KEY_ID']
      cf.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
      cf.distribution_id = ENV['AWS_CLOUDFRONT_DIST_ID']
    end
  end
end

With valid AWS creds, an s3 bucket, and cloudfront distribution id, you can deploy with the env var DEPLOY as a trigger (you can use whichever kind of trigger you like):

DEPLOY=true middleman build

S3 Deployment Note

The S3 deployer will check local file's md5 hash against the remote s3 etag. If they are the same, it will not upload the identical file. However, if you have :cachebuster set to active the hashes will always end up different on every build, triggering an upload. There's little such danger however for assets (css, images, etc).