Skip to content

Instantly share code, notes, and snippets.

@bartimaeus
Created September 12, 2019 06:02
Show Gist options
  • Save bartimaeus/501f2f7fced143d3053b1a2fac719893 to your computer and use it in GitHub Desktop.
Save bartimaeus/501f2f7fced143d3053b1a2fac719893 to your computer and use it in GitHub Desktop.
Example drone.io config for gatsby deploy to s3 and CloudFront
---
kind: pipeline
name: www [staging]
steps:
- name: build
image: node
environment:
GATSBY_GOOGLE_ANALYTICS_ID:
from_secret: staging_www_analytics_id
# ...
commands:
- cd packages/www
- yarn install
- yarn build
- name: sync
image: mesosphere/aws-cli
environment:
S3_BUCKET:
from_secret: staging_www_bucket_name
DISTRIBUTION_ID:
from_secret: staging_www_cloudfront_distribution_id
commands:
- aws s3 sync packages/www/public s3://$${S3_BUCKET} --cache-control "max-age=14400,public"
- aws s3 cp s3://$${S3_BUCKET}/index.html s3://$${S3_BUCKET}/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
- aws cloudfront create-invalidation --distribution-id $${DISTRIBUTION_ID} --paths '/*'
- name: slack
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel: status
template: >
{{#success build.status}}
*success* <{{build.link}}|www ({{build.branch}})> by {{build.author}}
{{else}}
*failure* <{{build.link}}|www ({{build.branch}})> by {{build.author}}
{{/success}}
when:
status: [success, failure]
trigger:
branch:
- develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment