version: 0.2 phases: install: runtime-versions: docker: 19 python: 3.7 ruby: 2.7 pre_build: commands: - locale-gen en_US en_US.UTF-8 - dpkg-reconfigure locales - export LC_ALL="en_US.UTF-8" - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) - IMAGE_TAG=${COMMIT_HASH:=latest} - | if [ ! -d ".git" ]; then echo Initializing Git Repo git init git remote add origin $FULL_REPO_URL git fetch git checkout -f "$CODEBUILD_RESOLVED_SOURCE_VERSION" fi - git submodule init - git submodule update --recursive --remote --merge - echo Install Hugo # Latest version of Hugo - curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "download_url.*Linux-64bit.tar.gz" | grep -v "extended" | cut -d '"' -f 4 | wget -qi - - HUGO_TAR="$(find . -name "*Linux-64bit.tar.gz")" - tar -xzf $HUGO_TAR - chmod +x hugo - gem install html-proofer # Copy deployment script so that build stage can access it - cp automation/content-build-deploy/deploy.sh /usr/local/bin/ - . automation/content-build-deploy/build-env.sh build: commands: - echo Build website - ./hugo -D --enableGitInfo - HTML_PROOFER="$(gem contents html-proofer | grep '/bin/')" - echo running html-proofer - $HTML_PROOFER ./public --check-html --empty-alt-ignore --allow-hash-href # fail if proofer has issues... if you want to deploy anyway, move these back to post_build - deploy.sh