forked from medic/cht-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 2.29 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
61
62
63
64
65
66
# 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]
name: Test site and push live if we're on Main
jobs:
BuildLinkCheckPushLive:
name:
runs-on: ubuntu-18.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 hugo extended v0.101.0
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.101.0"
extended: true
- name: All Branches - Install Node 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- 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/action-slack-notify@v2.0.2
env:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}'
SLACK_CHANNEL: '#cht-squad-docs'
SLACK_COLOR: '#3278BD'
SLACK_ICON: ":flappingphone:"
SLACK_MESSAGE: 'Deploy Failed'
SLACK_TITLE: CHT DOCS DEPLOY
SLACK_USERNAME: Medic-Bot