mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-10-14 13:04:26 -04:00
use same alpine image for both CI stages
This commit is contained in:
@@ -1,16 +1,20 @@
|
|||||||
|
image: python:3.6-alpine
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
HUGO_VERSION: '0.53' # https://github.com/gohugoio/hugo/releases
|
HUGO_VERSION: '0.53' # https://github.com/gohugoio/hugo/releases
|
||||||
HUGO_SHA: '0e4424c90ce5c7a0c0f7ad24a558dd0c2f1500256023f6e3c0004f57a20ee119' # xxx_Linux-64bit.tar.gz
|
HUGO_SHA: '0e4424c90ce5c7a0c0f7ad24a558dd0c2f1500256023f6e3c0004f57a20ee119' # xxx_Linux-64bit.tar.gz
|
||||||
|
AWSCLI_VERSION: '1.16.21' # https://github.com/aws/aws-cli/blob/master/CHANGELOG.rst
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- apk update && apk add openssl coreutils
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
image: alpine:latest
|
|
||||||
script:
|
script:
|
||||||
- apk update && apk add openssl coreutils
|
|
||||||
- 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
|
||||||
- echo "${HUGO_SHA} hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" | sha256sum -c
|
- 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
|
- tar xf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && cp ./hugo /usr/bin
|
||||||
@@ -22,31 +26,32 @@ build:
|
|||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: python:3.6-alpine
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- build
|
- build
|
||||||
script:
|
script:
|
||||||
- pip install awscli
|
- pip install --quiet --no-cache-dir awscli==${AWSCLI_VERSION}
|
||||||
|
|
||||||
- aws configure set preview.cloudfront true
|
- aws configure set preview.cloudfront true
|
||||||
- aws s3 sync ./public s3://$S3_BUCKET_NAME --delete --cache-control "max-age=86400, public" --metadata-directive "REPLACE"
|
- aws configure set preview.create-invalidation true
|
||||||
|
- aws s3 sync ./public s3://$S3_BUCKET_NAME --delete --region us-east-1 --cache-control "max-age=86400, public" --metadata-directive "REPLACE"
|
||||||
|
|
||||||
# set certain content-types manually because S3 sucks at guessing
|
# set certain content-types manually because S3 sucks at guessing
|
||||||
- aws s3 cp --exclude "*" --include "*.ico" --content-type="image/x-icon" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.ico" --content-type="image/x-icon" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.svg" --content-type="image/svg+xml" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.svg" --content-type="image/svg+xml" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.ttf" --content-type="font/ttf" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.ttf" --content-type="font/ttf" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.otf" --content-type="font/otf" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.otf" --content-type="font/otf" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.eot" --content-type="application/vnd.ms-fontobject" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.eot" --content-type="application/vnd.ms-fontobject" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.woff" --content-type="font/woff" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.woff" --content-type="font/woff" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.woff2" --content-type="font/woff2" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.woff2" --content-type="font/woff2" --cache-control "max-age=2628000, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.xml" --content-type="text/xml" --cache-control "max-age=3600, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.xml" --content-type="text/xml" --cache-control "max-age=3600, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.mp4" --content-type="video/mp4" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.mp4" --content-type="video/mp4" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.webm" --content-type="video/webm" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.webm" --content-type="video/webm" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.docx" --content-type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.docx" --content-type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --exclude "*" --include "*.pdf" --content-type="application/pdf" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.pdf" --content-type="application/pdf" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
|
||||||
|
|
||||||
# a few caching improvements
|
# a few caching improvements
|
||||||
- aws s3 cp --exclude "*" --include "*.jpg" --include "*.png" --include "*.gif" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME
|
- aws s3 cp s3://$S3_BUCKET_NAME s3://$S3_BUCKET_NAME --exclude "*" --include "*.jpg" --include "*.png" --include "*.gif" --cache-control "max-age=604800, public" --metadata-directive="REPLACE" --recursive
|
||||||
- aws s3 cp --content-type="text/plain; charset=utf-8" --cache-control "max-age=0, no-cache, no-store" --content-disposition "inline; filename=\"jarvis.asc\"" --metadata-directive="REPLACE" s3://$S3_BUCKET_NAME/jarvis.asc s3://$S3_BUCKET_NAME/jarvis.asc
|
- 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-cache, no-store" --content-disposition "inline; filename=\"jarvis.asc\"" --metadata-directive="REPLACE"
|
||||||
|
|
||||||
# invalidate entire CloudFront cache
|
# invalidate entire CloudFront cache
|
||||||
- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*";
|
- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*";
|
||||||
|
Reference in New Issue
Block a user