Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
74 lines (64 sloc) 2.42 KB
machine:
environment:
#
# Define environment variables used by the rest of the script
# These control the operation of the script
#
# Note:
# $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY are required
# but they are defined in CircleCI's UI.
#
HUGO_VERSION: 0.30.2
HUGO_ARCHIVE: hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
HUGO_SRC: https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/$HUGO_ARCHIVE
CIRCLE_BUILD_DIR: $HOME/$CIRCLE_PROJECT_REPONAME
PATH: $PATH:$CIRCLE_BUILD_DIR/bin
post:
- mkdir -p $CIRCLE_BUILD_DIR/bin
# Install hugo, pygments and s3deploy tools. These are not included
# in CircleCI's environment so they must be installed manually.
dependencies:
pre:
- >
if [ ! -e $CIRCLE_BUILD_DIR/bin/hugo ] || [[ `hugo version` =~ v${HUGO_VERSION} ]];
then
wget $HUGO_SRC;
tar xvzf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz -C $CIRCLE_BUILD_DIR/bin;
fi
# s3deploy simplifies static site deployment to S3
- go get -v github.com/bep/s3deploy
# speed things up for future builds
cache_directories:
- $CIRCLE_BUILD_DIR/bin
# use CircleCI's test stage to build the static site. If hugo exits
# with an error CircleCI will abort immediately.
test:
override:
- hugo -v
deployment:
s3up:
# deploy new assets to S3 when the `master` branch is updated.
branch: master
commands:
# updates: http://mostlygeek.com.s3-website-us-east-1.amazonaws.com
- s3deploy -source=public/ -region=us-east-1 -bucket=mostlygeek.com
# Invalidate everything in the CDN. Since we do not know what
# changed it is easier to just dump everything. Not a big
# deal since mostlygeek.com isn't a massive site.
#
# This is an async step. This task does not wait for the CDN
# to invalidate objects before continuing.
- aws configure set preview.cloudfront true
- >
aws cloudfront create-invalidation
--distribution-id $CLOUDFRONT_DISTRIBUTION_ID
--paths '/*'
# ping myself when the deployment steps have completed
# only if PUSHOVER credentials have been set in CircleCI's UI
- >
[ ! -z "$PUSHOVER_APP_TOKEN" ] && curl
--silent
--form-string "token=$PUSHOVER_APP_TOKEN"
--form-string "user=$PUSHOVER_USER_KEY"
--form-string "message=blog deploy complete"
"https://api.pushover.net/1/messages.json";