-
-
Notifications
You must be signed in to change notification settings - Fork 19
60 lines (51 loc) · 2.22 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 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