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:
@@ -1,4 +1,4 @@
|
|||||||
image: python:3.6-alpine
|
image: python:3.7-alpine
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
HUGO_VERSION: '0.53' # https://github.com/gohugoio/hugo/releases
|
HUGO_VERSION: '0.53' # https://github.com/gohugoio/hugo/releases
|
||||||
@@ -7,7 +7,7 @@ variables:
|
|||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
# update alpine
|
# update alpine
|
||||||
- apk update && apk add openssl coreutils
|
- apk update && apk add openssl curl coreutils
|
||||||
|
|
||||||
# download and install Hugo
|
# download and install Hugo
|
||||||
- wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
|
- 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
|
# install awscli
|
||||||
- pip install --quiet --no-cache-dir awscli==${AWSCLI_VERSION}
|
- pip install --quiet --no-cache-dir awscli==${AWSCLI_VERSION}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
script:
|
script:
|
||||||
# build site
|
# build site
|
||||||
- rm -rf public
|
- 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 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"
|
- 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:
|
only:
|
||||||
- master
|
- master
|
||||||
|
Reference in New Issue
Block a user