Adds CloudFront invalidation on deploy

This commit is contained in:
Samuel Ryan 2016-07-27 16:17:27 +01:00
parent 62df9e637c
commit f4cc5fd142

View File

@ -1,7 +1,14 @@
build="build-${CIRCLE_BUILD_NUM}"
echo "Preparing ${build}"
sudo mkdir ~/${build}
sudo cp -R ~/httpstatuses/build/. ~/${build}
echo "Deploying ${build} to ${DEPLOY_TARGET}"
rsync -r -l ~/${build} ${DEPLOY_TARGET}:/srv/www/httpstatuses.com
ssh ${DEPLOY_TARGET} "ln -sfn /srv/www/httpstatuses.com/${build} /srv/www/httpstatuses.com/live"
echo "Build deployed and pushed live"
rsync -r -l ~/${build} ${DEPLOY_TARGET}:${MY_DIRECTORY}
ssh ${DEPLOY_TARGET} "ln -sfn ${MY_DIRECTORY}/${build} ${MY_DIRECTORY}/live"
echo "Build deployed and pushed live"
echo "Creating CloudFront invalidation"
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths "/*"
echo "CloudFront invalidation submitted, invalidation will take up to 15 minutes"