Skip to content

Commit

Permalink
pin muffet to 1.3.3, merge ci files w conditional calls to push live …
Browse files Browse the repository at this point in the history
…for master, add test alerts to my own private channel #259
  • Loading branch information
mrjones-plip committed Aug 4, 2020
1 parent 0a5af49 commit 4a971da
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 93 deletions.
61 changes: 0 additions & 61 deletions .github/workflows/build-any.branch.yml

This file was deleted.

99 changes: 67 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,94 @@
name: CHT Documentation Site Build

on:
on:
push:
branches:
- master
# todo - make this run on all branches as we have conditionals below to only push to prod if we're on master
- 259-add-link-checker-to-ci
# - '*'
# - '!master'

name: Test site and push live if we're on Master
jobs:
build:

BuildAnyBranch:
name:
runs-on: ubuntu-18.04

steps:
steps:Z
- name: Git checkout
uses: actions/checkout@v2
with:
submodules: recursive # Fetch the Docsy theme
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Install Node depencies
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
- run: npm install -g postcss-cli
- run: npm i -D autoprefixer
# todo - verify this is safe to remove - not sure why we need node here
# - name: Install Node depencies
# uses: actions/setup-node@v1
# with:
# node-version: '12.x'
# - run: npm install
# - run: npm install -g postcss-cli
# - run: npm i -D autoprefixer

- name: Setup hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.71.1"
extended: true

- name: Build
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.14' # Pinning to current version as of Aug 3, 2020 for stability

- name: Install Muffet
run: env GO111MODULE="on" go get github.com/raviqqe/[email protected] # Pinning to current version as of Aug 3, 2020 for stability

- name: Serve Hugo site
run: hugo server& # run in background so CI doesn't hang waiting for ctrl + c

- name: Sleep so hugo server is ready
run: sleep 5

- name: Run Muffet link checkier
run: |
muffet http://localhost:1313 \
--buffer-size 50000 --timeout 15 --concurrency 1 --ignore-fragments --exclude ".*demo\.app\.medicmobile\.org.*" --exclude ".*download\.docker\.com.*" --exclude ".*www\.npmjs\.com/org/medic/team/developers" --exclude ".*github\.com/medic/cht-docs/issues/new.*" --exclude ".*localhost:5984.*"
- name: Build if on Master
if: github.ref == 'refs/heads/master'
run: env HUGO_ENV="production" hugo --minify

- name: Deploy
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: master

- name: Failed Deploy
# todo - uncomment before closing - push docs live
# - name: Deploy to GH pages if on Master
# if: github.ref == 'refs/heads/master'
# 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: master

# todo - remove this before merging to master ;)
- name: Report errors to slack if on Master
if: ${{ failure() }} && github.ref != 'refs/heads/master'
uses: rtCamp/[email protected]
if: ${{ failure() }}
env:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEB_HOOK }}'
SLACK_CHANNEL: '#cht-squad-docs'
SLACK_CHANNEL: '#mrjones-testing-channel'
SLACK_COLOR: '#3278BD'
SLACK_ICON: ":flappingphone:"
SLACK_MESSAGE: 'Deploy Failed'
SLACK_TITLE: CHT DOCS DEPLOY
SLACK_MESSAGE: 'GH Action Testing Failed - zomg!'
SLACK_TITLE: CHT DOCS DEPLOY
SLACK_USERNAME: Medic-Bot


- name: Report errors to slack if on Master
if: ${{ failure() }} && github.ref == 'refs/heads/master'
uses: rtCamp/[email protected]
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

0 comments on commit 4a971da

Please sign in to comment.