Skip to content

Instantly share code, notes, and snippets.

@KevinVR
Last active August 29, 2021 13:48
Show Gist options
  • Save KevinVR/51cc39117d3cbdfb1cae040bb0f49e6b to your computer and use it in GitHub Desktop.
Save KevinVR/51cc39117d3cbdfb1cae040bb0f49e6b to your computer and use it in GitHub Desktop.
image: node:latest
# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
paths:
- node_modules/
pages:
script:
- yarn install
- ./node_modules/.bin/gatsby build --prefix-paths
artifacts:
paths:
- public
expire_in: 2 days
only:
- master
deploy_s3:
stage: deploy
image: python:latest
script:
- echo "Deploy to S3 ..."
- pip install awscli
- aws s3 sync ./public/ s3://<REPLACE_WITH_BUCKET_NAME>/ --exclude "*.map" --delete
- echo "Deployed to S3 successfully!"
- echo "Invalidating cloudfront..."
- aws cloudfront create-invalidation --distribution-id <REPLACE_WITH_DISTRIBUTION_ID> --paths "/*"
- echo "Invalidated cloudfront successfully!"
environment:
name: Production
url: <REPLACE_WITH_WEB_URL>
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment