Move target section #7523
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Notes: | |
# - All software installed below is pinned so they don't get upgraded and break w/o us knowing why. | |
# - If you bump one version up to latest, please bump them all so we stay current! | |
# - Hugo builds the site twice: once for link checking and once minified for pushing live | |
# - Bash script for muffet is intentionally stand alone so devs/content editors can easily run it locally | |
on: [push, pull_request] | |
# This action tests site and pushes live if we're on Main | |
# Changes to the `name` will break the build status image in the readme | |
name: CHT Documentation Site Build | |
jobs: | |
BuildLinkCheckPushLive: | |
name: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 15 | |
steps: | |
- name: All Branches - Git checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: All Branches - Install asdf & tools in .tool-versions | |
uses: asdf-vm/actions/install@v2 | |
- name: All Branches - Install npm modules for Hugo | |
run: npm install | |
# Run "build" to catch errors as early as possible in CI | |
- name: All Branches - Test For Broken Builds in Hugo | |
run: hugo | |
- name: Main Branch Only - Build for prod with minify | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: env HUGO_ENV="production" hugo --minify | |
- name: Main Branch Only - Deploy to GH pages | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.DEPOLY_TO_SITE}} | |
external_repository: medic/medic.github.io | |
publish_dir: ./public | |
user_name: medic-ci | |
user_email: medic-ci@github | |
publish_branch: main | |
- name: Main Branch Only - Report errors to Slack, if any | |
if: ${{ github.ref == 'refs/heads/main' && failure() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}' | |
SLACK_CHANNEL: '#cht-doc-site' | |
SLACK_COLOR: '#3278BD' | |
SLACK_ICON: ":flappingphone:" | |
SLACK_MESSAGE: 'Deploy Failed' | |
SLACK_TITLE: CHT DOCS DEPLOY | |
SLACK_USERNAME: Medic-Bot |