1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 08:01:16 -04:00

switch CI deployment to s3 and cloudfront

This commit is contained in:
2019-02-15 12:29:25 -05:00
parent 3b73ada4bf
commit 8e14b04754
4 changed files with 26 additions and 130 deletions

View File

@@ -1,5 +0,0 @@
{
"projects": {
"default": "jakejarvis-com"
}
}

View File

@@ -1,20 +1,34 @@
image: node: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
before_script: stages:
- build
- deploy
build:
stage: build
image: alpine:latest
script:
- apk update && apk add openssl coreutils - 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
- npm config set unsafe-perm true - rm -rf public
- npm install --quiet firebase-tools -g - hugo
artifacts:
paths:
- public
deploy: deploy:
stage: deploy stage: deploy
image: python:3.6-alpine
dependencies:
- build
script: script:
- rm -rf public - pip install awscli
- hugo - aws configure set preview.cloudfront true
- firebase deploy --token $FIREBASE_TOKEN - aws s3 sync ./public s3://$S3_BUCKET_NAME --delete --metadata-directive REPLACE
- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*";
only:
- master

View File

@@ -1,113 +0,0 @@
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/.git/**"
],
"redirects": [
{
"source": "/powncer.mov",
"destination": "/leo.mp4",
"type": 301
},
{
"source": "/powncer.mp4",
"destination": "/leo.mp4",
"type": 301
}
],
"headers": [
{
"source": "**",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=31536000; includeSubDomains; preload"
},
{
"key": "Expect-CT",
"value": "max-age=0, report-uri=https://jarvis.report-uri.com/r/d/ct/reportOnly"
},
{
"key": "Cache-Control",
"value": "max-age=86400, public"
},
{
"key": "X-UA-Compatible",
"value": "IE=edge"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block; report=https://jarvis.report-uri.com/r/d/xss/enforce"
},
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; script-src 'self' stats.jarv.is 'sha256-TLAu2p9kt4LHt+sWwE0cvqq1Ok5LoGzRPrw7+mzhX00='; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; frame-src 'self'; connect-src 'self' jarvis.report-uri.com stats.jarv.is; upgrade-insecure-requests; report-uri https://jarvis.report-uri.com/r/d/csp/enforce"
},
{
"key": "Referrer-Policy",
"value": "no-referrer-when-downgrade"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-DNS-Prefetch-Control",
"value": "off"
}
]
},
{
"source": "**/*.@(css|js|pdf)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=86400, public"
}
]
},
{
"source": "**/*.@(jpg|jpeg|gif|png|ico|mov|mp4)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=2628000, public"
}
]
},
{
"source": "**/*.@(ttf|otf|woff|woff2|svg|eot)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000, public"
}
]
},
{
"source": "jarvis.asc",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=0, no-cache, no-store"
},
{
"key": "Content-Type",
"value": "text/plain; charset=utf-8"
},
{
"key": "Content-Disposition",
"value": "inline; filename=\"jarvis.asc\""
}
]
}
]
}
}

View File