2021-10-02 05:57:47 +00:00
|
|
|
---
|
2020-07-18 06:28:13 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2021-10-02 05:57:47 +00:00
|
|
|
test:
|
2020-07-18 06:28:13 +00:00
|
|
|
docker:
|
|
|
|
- image: cibuilds/hugo:latest
|
2021-10-02 05:57:47 +00:00
|
|
|
|
2020-07-18 06:28:13 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
2021-10-02 05:57:47 +00:00
|
|
|
|
|
|
|
# TODO: Uncomment below two lines and install git further up if submodules end up being added
|
|
|
|
# install git submodules for managing third-part dependencies
|
|
|
|
# - run: git submodule sync && git submodule update --init
|
2020-07-18 06:28:13 +00:00
|
|
|
|
|
|
|
- run:
|
2021-10-02 05:57:47 +00:00
|
|
|
name: Build HTML files
|
|
|
|
command: HUGO_ENV=production hugo -v --minify
|
2020-07-18 06:28:13 +00:00
|
|
|
|
2021-10-02 05:57:47 +00:00
|
|
|
- run:
|
2020-07-18 06:28:13 +00:00
|
|
|
name: Test generated HTML files
|
|
|
|
command: |
|
|
|
|
htmlproofer public --allow-hash-href --check-html \
|
|
|
|
--empty-alt-ignore --disable-external
|
|
|
|
|
2021-10-02 05:57:47 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: .
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
- config
|
|
|
|
- themes
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
docker:
|
|
|
|
- image: cibuilds/hugo:latest
|
|
|
|
environment:
|
|
|
|
PROD_DEPLOY_CONFIG_PATH: config/production/deployment.toml
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- attach_workspace:
|
|
|
|
at: .
|
|
|
|
|
|
|
|
- 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
|
|
|
- deploy:
|
2021-10-02 05:57:47 +00:00
|
|
|
name: Deploy to AWS
|
2020-07-18 06:28:13 +00:00
|
|
|
command: |
|
2021-10-02 05:57:47 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
main-workflow:
|
|
|
|
jobs:
|
|
|
|
- test
|
|
|
|
|
|
|
|
- deploy:
|
|
|
|
context: aws-context
|
|
|
|
requires:
|
|
|
|
- test
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
|
|
|
- main
|