From f4cc5fd142196be4928a8d783f4fd8cd6c423d37 Mon Sep 17 00:00:00 2001 From: Samuel Ryan Date: Wed, 27 Jul 2016 16:17:27 +0100 Subject: [PATCH] Adds CloudFront invalidation on deploy --- deploy.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index ea27e48..ae4574a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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" \ No newline at end of file +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"