forked from nokia-eda/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·77 lines (60 loc) · 2.25 KB
/
run.sh
File metadata and controls
executable file
·77 lines (60 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
# Copyright 2024 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
set -o errexit
set -o pipefail
set -e
MKDOCS_IMAGE=ghcr.io/nokia-eda/mkdocs-material-insiders:9.6.12-insiders-4.53.16-hellt
MIKE_CMD="docker run -it --rm -p 8000:8000 \
-v $(pwd):/docs \
-v ${HOME}/.gitconfig:/root/.gitconfig \
-v ${HOME}/.ssh:/root/.ssh \
-v $(echo $SSH_AUTH_SOCK):/tmp/ssh_agent_socket \
-e SSH_AUTH_SOCK=/tmp/ssh_agent_socket \
--entrypoint mike ${MKDOCS_IMAGE}"
function serve-docs {
# serve development documentation portal
docker run -it --rm -p 8000:8000 -v $(pwd):/docs ${MKDOCS_IMAGE} serve --dirtyreload -a 0.0.0.0:8000
}
function serve-docs-full {
# serve development documentation portal
docker run -it --rm -p 8000:8000 -v $(pwd):/docs ${MKDOCS_IMAGE} serve -a 0.0.0.0:8000
}
function build-docs {
docker run --rm -v $(pwd):/docs --entrypoint mkdocs ${MKDOCS_IMAGE} build --clean --strict
}
function test-docs {
docker run --rm -v $(pwd):/docs --entrypoint mkdocs ${MKDOCS_IMAGE} build --clean --strict
docker run --rm -v $(pwd):/test wjdp/htmltest --conf ./site/htmltest.yml
sudo rm -rf ./site
}
# -----------------------------------------------------------------------------
# Version management.
# -----------------------------------------------------------------------------
function list-versions {
${MIKE_CMD} list -r internal -b versioned-docs-test
}
function build-versions {
${MIKE_CMD} deploy $1
}
function set-default-version {
${MIKE_CMD} set-default -r internal -b versioned-docs-test --push latest
}
function deploy-version {
${MIKE_CMD} deploy -r internal -b versioned-docs-test --push $@
}
function mike-serve {
${MIKE_CMD} serve -a 0.0.0.0:8000 -r internal -b versioned-docs-test
}
# -----------------------------------------------------------------------------
# Bash runner functions.
# -----------------------------------------------------------------------------
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
# This idea is heavily inspired by: https://github.com/adriancooney/Taskfile
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"