alejandr0angul0.dev/.circleci/config.yml

37 lines
1.2 KiB
YAML
Raw Normal View History

2020-07-18 06:28:13 +00:00
version: 2
jobs:
build:
docker:
- image: cibuilds/hugo:latest
steps:
# clone repo
- checkout
- run: git submodule sync && git submodule update --init
- run:
name: install AWS CLI
command: |
sudo apt update
sudo apt install python3-pip
pip3 install awscli
2020-07-18 06:28:13 +00:00
# build with hugo
2020-07-18 20:52:44 +00:00
- run: HUGO_ENV=production hugo -v --minify
2020-07-18 06:28:13 +00:00
- run:
name: Test generated HTML files
command: |
htmlproofer public --allow-hash-href --check-html \
--empty-alt-ignore --disable-external
- deploy:
name: deploy to AWS
command: |
if [ "${CIRCLE_BRANCH}" = "master" ]; then
export PROD_DEPLOY_CONFIG_PATH="config/production/deployment.toml"
sed "s~{{S3URL}}~${S3URL}~g" "${PROD_DEPLOY_CONFIG_PATH}.sample" > "${PROD_DEPLOY_CONFIG_PATH}"
sed -i "s~{{CLOUDFRONTDISTRIBUTIONID}}~${CLOUDFRONTDISTRIBUTIONID}~g" "${PROD_DEPLOY_CONFIG_PATH}"
HUGO_ENV=production hugo deploy --invalidateCDN
else
echo "Not master branch, not deploying"
fi