Last active
August 29, 2021 13:48
-
-
Save KevinVR/51cc39117d3cbdfb1cae040bb0f49e6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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