Skip to content

Instantly share code, notes, and snippets.

@phongvh
Last active June 18, 2018 12:52
Show Gist options
  • Save phongvh/ee60b67758d27c37a0b6089773291f74 to your computer and use it in GitHub Desktop.
Save phongvh/ee60b67758d27c37a0b6089773291f74 to your computer and use it in GitHub Desktop.
variables:
S3_BUCKET_PRODUCTION: "react101.com"
S3_BUCKET_DEVELOPMENT: "react101-dev"
CLOUDFRONT_DISTRIBUTION_ID: [FILL THIS YOURSELF]
deploy production:
stage: build
image: nikolaik/python-nodejs:latest
script:
- yarn
- yarn test
- yarn build
- pip install awscli
- aws s3 cp ./build/ s3://$S3_BUCKET_PRODUCTION/ --recursive --include "*"
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
- echo "Deploy to https://react101.com"
artifacts:
paths:
- build
environment:
name: production
url: https://react101.com
only:
- master
deploy development:
stage: build
image: nikolaik/python-nodejs:latest
script:
- yarn
- yarn test
- yarn build
- pip install awscli
- aws s3 cp ./build/ s3://$S3_BUCKET_DEVELOPMENT/ --recursive --include "*"
- echo "Deploy to http://react101-dev.s3-website-us-west-2.amazonaws.com"
environment:
name: development
url: http://react101-dev.s3-website-us-west-2.amazonaws.com
only:
- develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment