Middleman to Amazon S3

November 23, 2014

middleman

aws

tool

middleman の使い方について

AWS にデプロイ用ユーザを作成

Amazon S3 にバケツ(公開用フォルダ)作成

Travis CI の設定

AWS デプロイ用ユーザ作成時の Access Key ID を暗号化

# travis encrypt -r tsujimitsu/codelogue ***********
Please add the following to your .travis.yml file:
  secure: '**********'

同じ要領で Secret Access Key も暗号化(-r の後ろは github のリポジトリを指定)

travis encrypt -r tsujimitsu/codelogue **********
Please add the following to your .travis.yml file:

  secure: "**********"

travis.yml に追記

language: ruby
script: bundle exec middleman build && ls -la ./build

deploy:
  provider: s3
  access_key_id:
    secure: "XXX"
  secret_access_key:
    secure: "XXX"
  bucket: www.codelogue.com
  region: tokyo
  endpoint: ***********************.amazonaws.com
  skip_cleanup: true
  local-dir: build/
  on:
    branch: master

skip_cleanup と local-dir が重要

参考