Skip to content

Commit

Permalink
docs: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrarimarco committed Oct 19, 2024
1 parent 35fce56 commit d81da22
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 6 deletions.
6 changes: 6 additions & 0 deletions config/mkdocs/home-lab-docs/mkdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
docs_dir: "../../../../docs"
site_name: Home Lab docs
site_url: https://ferrarimarco.github.io/home-lab
theme:
name: material
3 changes: 1 addition & 2 deletions scripts/build-arduino-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ if [ -n "${ARDUINO_BOARD_PORT}" ]; then
if [ ! -e "${ARDUINO_BOARD_PORT}" ]; then
echo "[ERROR] ${ARDUINO_BOARD_PORT} is not available."
# Ignoring because those are defined in common.sh, and don't need quotes
# shellcheck disable=SC2086
exit ${ERR_ARGUMENT_EVAL}
exit "${ERR_ARGUMENT_EVAL}"
fi

if [ "${ARDUINO_UPLOAD:-"true"}" = "true" ]; then
Expand Down
48 changes: 48 additions & 0 deletions scripts/build-mkdocs-site.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

# shellcheck source=/dev/null
. "./scripts/common.sh"

# renovate: datasource=docker packageName=squidfunk/mkdocs-material versioning=docker
MKDOCS_CONTAINER_IMAGE_VERSION="9.5.41"
MKDOCS_CONTAINER_IMAGE="squidfunk/mkdocs-material:${MKDOCS_CONTAINER_IMAGE_VERSION}"

echo "Running mkdocs: ${MKDOCS_CONTAINER_IMAGE}"

SUBCOMMAND="${1}"
echo "Subcommand: ${SUBCOMMAND}"

RUN_CONTAINER_COMMAND=(
docker run
--rm
)

if [ -t 0 ]; then
RUN_CONTAINER_COMMAND+=(
--interactive
--tty
)
fi

RUN_CONTAINER_COMMAND+=(
--name "mkdocs"
--volume "$(pwd)":/docs
--volume /etc/localtime:/etc/localtime:ro
"${MKDOCS_CONTAINER_IMAGE}"
)

if [[ "${1}" == "serve" ]]; then
RUN_CONTAINER_COMMAND+=(
"serve"
"--dev-addr=0.0.0.0:8000"
"--config-file" config/mkdocs/home-lab-docs/mkdocs.yaml
)
elif [[ "${1}" == "bootstrap" ]]; then
RUN_CONTAINER_COMMAND+=(
"new"
.
)
fi

echo "Run container command: ${RUN_CONTAINER_COMMAND[*]}"
"${RUN_CONTAINER_COMMAND[@]}"
3 changes: 3 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ CD_CONTAINER_URL="ferrarimarco/home-lab-cd:latest"

GITHUB_TOKEN_PATH="$(pwd)/.github-personal-access-token"

# shellcheck disable=SC2034
HOME_LAB_DOCS_CONFIGURATION_FILE_PATH="config/mkdocs/home-lab-docs/mkdocs.yml"

_DOCKER_INTERACTIVE_TTY_OPTION=
if [ -t 0 ]; then
_DOCKER_INTERACTIVE_TTY_OPTION="-it"
Expand Down
6 changes: 2 additions & 4 deletions scripts/run-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ if [ -n "${ANSIBLE_TEST_DISTRO:-}" ]; then
ANSIBLE_TEST_PLAYBOOK_FULL_PATH="config/ansible/molecule/default/${ANSIBLE_TEST_PLAYBOOK_PATH}"
if [ ! -f "${ANSIBLE_TEST_PLAYBOOK_FULL_PATH}" ]; then
echo "The playbook file does not exist: ${ANSIBLE_TEST_PLAYBOOK_FULL_PATH}"
# shellcheck disable=SC2086
exit ${ERR_ANSIBLE_TEST_MISSING_PLAYBOOK}
exit "${ERR_ANSIBLE_TEST_MISSING_PLAYBOOK}"
fi

COMMAND_TO_RUN="${COMMAND_TO_RUN} --env ANSIBLE_TEST_DISTRO=${ANSIBLE_TEST_DISTRO}"
Expand All @@ -86,8 +85,7 @@ else

if [ ! -f "${ANSIBLE_VAULT_PASSWORD_FILE_PATH}" ]; then
echo "The Ansible vault password file does not exist: ${ANSIBLE_VAULT_PASSWORD_FILE_PATH}"
# shellcheck disable=SC2086
exit ${ERR_ANSIBLE_MISSING_PASSWORD_FILE}
exit "${ERR_ANSIBLE_MISSING_PASSWORD_FILE}"
fi
fi

Expand Down

0 comments on commit d81da22

Please sign in to comment.