mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 12:16:21 -04:00
35 lines
1.3 KiB
YAML
35 lines
1.3 KiB
YAML
image: python:3.7-alpine
|
|
|
|
variables:
|
|
HUGO_VERSION: '0.53' # https://github.com/gohugoio/hugo/releases
|
|
HUGO_SHA: '0e4424c90ce5c7a0c0f7ad24a558dd0c2f1500256023f6e3c0004f57a20ee119' # xxx_Linux-64bit.tar.gz
|
|
AWSCLI_VERSION: '1.16.220' # https://github.com/aws/aws-cli/blob/master/CHANGELOG.rst
|
|
|
|
before_script:
|
|
# update alpine
|
|
- apk update && apk add openssl curl coreutils git
|
|
|
|
# download and install Hugo
|
|
- wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
|
|
- echo "${HUGO_SHA} hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" | sha256sum -c
|
|
- tar xf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && cp ./hugo /usr/bin
|
|
|
|
# install awscli
|
|
- pip install --quiet --no-cache-dir awscli==${AWSCLI_VERSION}
|
|
|
|
deploy:
|
|
script:
|
|
# build site
|
|
- rm -rf public
|
|
- hugo --gc
|
|
|
|
# upload all files
|
|
- aws s3 sync ./public s3://$S3_BUCKET_NAME --delete --region us-east-1 --cache-control "max-age=3600, public" --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
|