From c2a5fc60c61a8abc13d95f584665e6972080776a Mon Sep 17 00:00:00 2001 From: JoniVR Date: Sat, 11 Dec 2021 17:14:43 +0100 Subject: [PATCH] build: setup for local development --- .gitignore | 5 +++ README.md | 16 +++++++- docker.sh | 4 ++ _config.yml => docs/_config.yml | 3 ++ scripts/generate-changelog.sh | 70 --------------------------------- 5 files changed, 26 insertions(+), 72 deletions(-) create mode 100644 docker.sh rename _config.yml => docs/_config.yml (51%) delete mode 100755 scripts/generate-changelog.sh diff --git a/.gitignore b/.gitignore index 95a2847..fbe810c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ ### macOS ### .DS_Store + +# jekyll local +.jekyll-cache +.sass-cache +_site \ No newline at end of file diff --git a/README.md b/README.md index 2296b36..36bce8c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,17 @@ -This branch is reserved for the project GitHub pages. +# MonitorControl Github Pages -To test Github pages locally, follow: +## Development + +### Using Docker (recommended) + +See [starefossen/github-pages](https://github.com/Starefossen/docker-github-pages): + +```sh +docker run -it --rm -v "$PWD":/usr/src/app -p "4000:4000" starefossen/github-pages +``` + +or run the handy `docker.sh` script. + +### Using jekyll local install diff --git a/docker.sh b/docker.sh new file mode 100644 index 0000000..84aa804 --- /dev/null +++ b/docker.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd docs +docker run -it --rm -v "$PWD":/usr/src/app -p "4000:4000" starefossen/github-pages \ No newline at end of file diff --git a/_config.yml b/docs/_config.yml similarity index 51% rename from _config.yml rename to docs/_config.yml index 4966a6e..af2a55f 100644 --- a/_config.yml +++ b/docs/_config.yml @@ -3,3 +3,6 @@ defaults: path: 'wiki' values: layout: 'wiki' + +repository: MonitorControl/MonitorControl +theme: jekyll-theme-primer diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh deleted file mode 100755 index 0b0c19c..0000000 --- a/scripts/generate-changelog.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -# Note: Make sure to only run this script after posting release notes in Github with a release! -# Could be expanded to also do appcast.xml updates? - -exists() { - type "$1" &>/dev/null && return 0 || return 1 -} - -show_error() { - local msg="Error!" - if [ ! -z "$1" ]; then - msg="$1" - fi - echo -e "\033[0;31m${msg}\033[0m" -} - -show_warning() { - local msg="Warning!" - if [ ! -z "$1" ]; then - msg="$1" - fi - echo -e "\033[0;33m${msg}\033[0m" -} - -show_success() { - local msg="Success!" - if [ ! -z "$1" ]; then - msg="$1" - fi - echo -e "\033[0;32m${msg}\033[0m" -} - -if ! exists jq; then - show_error "\`jq\` is required but not installed. Install using: brew install jq" - exit 127 -fi - -if ! exists pandoc; then - show_error "\`pandoc\` is required but not installed. Install using: brew install pandoc" - exit 127 -fi - -# TODO: Expand to check last x (per_page) releases (input parameter or fallback) -URL="https://api.github.com/repos/MonitorControl/MonitorControl/releases?per_page=1" - -# store the whole response -HTTP_RESPONSE=$(curl --fail -s $URL) - -if [ $? != 0 ]; then - show_error "Something went wrong getting Github Release info. Exiting..." - exit 1 -fi - -TAG=`echo $HTTP_RESPONSE | jq '.[0].tag_name' -r` -DIR="`dirname $0`/../docs/changelogs/" -FILE_NAME="${TAG}.html" -FILE="$DIR$FILE_NAME" - -if [ -f $FILE ]; then - show_warning "\"$FILE_NAME\" Already exists! Will be overwritten.." -fi - -echo $HTTP_RESPONSE | jq '.[0].body' -r | pandoc --template $DIR/template.html --metadata title="$TAG" -o $FILE - -if [ $? -eq 0 ]; then - show_success "\"$FILE_NAME\" Created at \"$DIR\"" -fi - -exit \ No newline at end of file