Skip to content

Instantly share code, notes, and snippets.

@unloadedroe
Forked from miguelmota/buildspec.yml
Created October 23, 2018 12:28
Show Gist options
  • Save unloadedroe/8faff7da7f1dc471042ffa24e404434f to your computer and use it in GitHub Desktop.
Save unloadedroe/8faff7da7f1dc471042ffa24e404434f to your computer and use it in GitHub Desktop.
AWS CodePipeline CodeBuild middleman build deploy to S3 and invalidate cloudfront cache
version: 0.1
phases:
install:
commands:
- apt-get update
- apt-get install nodejs -y
- gem install bundler
- gem install middleman
pre_build:
commands:
- bundle install
build:
commands:
- middleman build
post_build:
commands:
- aws s3 sync build/ "s3://${BUCKET_NAME}" --acl=public-read --delete
- aws cloudfront create-invalidation --distribution-id "${DISTRIBUTION_ID}" --paths /index.html /* /fonts/* /images/* /javascripts/* /stylesheets/* /favicon.ico
- Give CodeBuild project role access to S3 and CloudFront
- Set specified environment variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment