Skip to content

🆕 🎉 First launch of UNICEF Coach Cards for O.S. Mentorship #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest that instead of tidying the HTML, we may want to minify it. Hugo has the option to minify the output.

Note that you can also minify the final HTML output to /public by running hugo --minify
https://gohugo.io/hugo-pipes/minification/

- 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 = [email protected]:unicef/inventory-hugo-theme.git
Loading