1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-14 13:24:25 -04:00

purge cloudflare cache from CI pipeline

This commit is contained in:
2019-04-01 15:30:36 -04:00
parent 046e5fd2a8
commit ededcc05c4

View File

@@ -1,4 +1,4 @@
image: python:3.6-alpine
image: python:3.7-alpine
variables:
HUGO_VERSION: '0.53' # https://github.com/gohugoio/hugo/releases
@@ -7,7 +7,7 @@ variables:
before_script:
# update alpine
- apk update && apk add openssl coreutils
- apk update && apk add openssl curl coreutils
# download and install Hugo
- wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
@@ -17,7 +17,7 @@ before_script:
# install awscli
- pip install --quiet --no-cache-dir awscli==${AWSCLI_VERSION}
deploy:
deploy:
script:
# build site
- rm -rf public
@@ -44,5 +44,12 @@ deploy:
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.css" --include "*.js" --include "*.jpg" --include "*.png" --include "*.gif" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
- aws s3 cp s3://$S3_BUCKET_NAME/jarvis.asc s3://$S3_BUCKET_NAME/jarvis.asc --content-type="text/plain; charset=utf-8" --cache-control "max-age=0, no-store, no-cache, must-revalidate" --content-disposition "inline; filename=\"jarvis.asc\"" --metadata-directive="REPLACE"
# purge CloudFlare cache
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
only:
- master