Skip to content

Commit

Permalink
🆕 🎉 First launch of UNICEF Coach Cards for O.S. Mentorship
Browse files Browse the repository at this point in the history
This commit converts this conceptual repository into a prototype
project. This uses the Hugo static site generator to create a quick
website for evaluating and rating the performance of UNICEF portfolio
companies in a report card-like setting. It uses the UNICEF Inventory
Hugo theme to accomplish this.

Related to #1.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:bug: :wrench: ci: Fix Shellcheck warnings in deploy script

Warnings identified by @iperdomo in PR #2.

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>

:alembic: :wrench: ci: Use verbose HTML-Proofer error messages in logs

This commit updates the CircleCI Hugo orb to v1.3.0. This change
incorporates changes I made upstream in the Hugo orb so HTML-Proofer
will print verbose error messages if there is a failure. Currently,
error messages are suppressed in the CircleCI logs and this makes
debugging difficult. Additionally, the `asciidoc` binary is now included
in the container image used in this build, so specifying the Asciidoc
parameter in the CircleCI config is no longer necessary.

Related GitHub Pull Requests:

* CircleCI-Public/hugo-orb#47
* CircleCI-Public/hugo-orb#48
* CircleCI-Public/hugo-orb#50

Signed-off-by: Justin W. Flory (he/him) [UNICEF Innovation] <jflory@unicef.org>
  • Loading branch information
jwflory committed Mar 11, 2022
1 parent ef432c9 commit a471246
Show file tree
Hide file tree
Showing 13 changed files with 1,028 additions and 709 deletions.
69 changes: 69 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
# https://circleci.com/docs/2.0/configuration-reference
version: 2.1

orbs:
hugo: circleci/hugo@1.3.0

workflows:
main:
jobs:
- hugo/build:
html-proofer: true
htmlproofer-http-status-ignore: "'0,999'"
htmlproofer-url-ignore: "'/coach/'"
htmlproofer-timeframe: "'6w'"
version: "latest"
- html-tidy:
filters:
branches:
only: main
requires:
- hugo/build
- deploy:
filters:
branches:
only: main
requires:
- hugo/build
- html-tidy

jobs:
html-tidy:
docker:
- image: cimg/ruby:3.0
steps:
- run: gem install htmlbeautifier
- attach_workspace:
at: .
- run: htmlbeautifier --tab $(find public/ -name '*.html' -print)
- persist_to_workspace:
root: .
paths:
- public
deploy:
docker:
- image: cibuilds/base:latest
working_directory: ~/hugo
environment:
HUGO_BUILD_DIR: ~/hugo/coach/public
steps:
# add repository deploy key (for pull/push access)
- add_ssh_keys:
fingerprints:
- "21:74:62:c8:10:59:77:7c:9d:96:cf:c8:69:84:1f:bb"

# deploy.sh dependencies
- run: apk add rsync

# clone repo (required to access `.circleci/deploy.sh`)
- run: git clone --depth=1 https://github.com/unicef/coach.git

# checkout generated html
- attach_workspace:
at: coach

# deploy to production
- deploy:
name: Deploy to GitHub Pages
command: ./coach/.circleci/deploy.sh
34 changes: 34 additions & 0 deletions .circleci/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# Force-push the built HTML to the `gh-pages` branch.
#

set -eu

DEPLOY_DIR=~/project

# trust GitHub server keys
if [[ ! -d ~/.ssh/ ]]; then
mkdir ~/.ssh/
fi
ssh-keyscan github.com >> ~/.ssh/known_hosts

# stage generated HTML for GitHub Pages
git clone --quiet --branch=gh-pages "$CIRCLE_REPOSITORY_URL" "$DEPLOY_DIR"
rsync --archive --recursive --verbose --remove-source-files $HOME/hugo/$CIRCLE_PROJECT_REPONAME/public/* "$DEPLOY_DIR"

# git client setup
cd "$DEPLOY_DIR"
git config --global push.default simple
git config --global user.email "$(git --no-pager show --no-patch --format='%ae' HEAD)"
if [ -n $CIRCLE_USERNAME ]; then
git config --global user.name "$CIRCLE_USERNAME"
else
git config --global user.name "Committer not registered on CircleCI"
fi
git config --global --get-regexp "(push.default|user.(email|name))"

# force push to GitHub Pages
git add --force .
git commit --verbose --message="Deploy build $CIRCLE_BUILD_NUM [ci skip]" || true
git push --verbose --force origin gh-pages
172 changes: 172 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
############################ ----- FRAMEWORKS ----- ###########################

##### ---- Hugo ---- #####
# Generated files by hugo
.hugo_build.lock
/public/
/resources/_gen/

# Executable may be added to repository
hugo.exe
hugo.darwin
hugo.linux

##### ---- htmlproofer ---- #####
/tmp/


######################## ----- OPERATING SYSTEMS ----- ########################

##### ---- Linux ---- #####
*~

# temporary files which can be created if a process still has a handle open of
# a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being
# accessed
.nfs*


##### ---- macOS ---- #####
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


##### ---- Windows ---- #####
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk



##### ----- PROGRAMMING LANGUAGES ----- #####

##### ---- Go ---- #####
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/



########################### ----- TEXT EDITORS ----- ##########################

##### ---- Sublime Text ---- #####
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# Workspace files are user-specific
*.sublime-workspace

# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project

# SFTP configuration file
sftp-config.json
sftp-config-alt*.json

# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache

# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings


##### ---- Vim ---- #####
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# Session
Session.vim
Sessionx.vim

# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "themes/inventory"]
path = themes/inventory
url = git@github.com:unicef/inventory-hugo-theme.git
Loading

0 comments on commit a471246

Please sign in to comment.