2019-12-30 08:24:08 +03:00
|
|
|
#!/bin/bash
|
2022-07-19 16:38:50 +03:00
|
|
|
|
2023-03-22 00:44:13 +03:00
|
|
|
SERVE=no
|
|
|
|
if [ "$1" == "serve" ] ; then
|
|
|
|
SERVE=yes
|
|
|
|
fi
|
|
|
|
|
2023-03-27 05:47:48 +03:00
|
|
|
for util in gelatyx ; do
|
2023-02-26 04:19:47 +03:00
|
|
|
if ! hash $util 2>/dev/null ; then
|
|
|
|
cargo install $util --locked
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-01-23 17:15:50 +03:00
|
|
|
tracked_markdown=$(mktemp)
|
|
|
|
trap "rm ${tracked_markdown}" "EXIT"
|
2023-03-21 19:31:49 +03:00
|
|
|
find docs -type f | egrep '\.(markdown|md)$' > $tracked_markdown
|
2022-07-19 16:38:50 +03:00
|
|
|
|
2023-01-23 17:15:50 +03:00
|
|
|
gelatyx --language lua --file-list $tracked_markdown --language-config ci/stylua.toml
|
|
|
|
gelatyx --language lua --file-list $tracked_markdown --language-config ci/stylua.toml --check || exit 1
|
2022-07-19 16:38:50 +03:00
|
|
|
|
2023-03-16 09:36:23 +03:00
|
|
|
set -ex
|
2019-12-30 08:24:08 +03:00
|
|
|
|
2022-12-22 20:52:42 +03:00
|
|
|
# Use the GH CLI to make an authenticated request if available,
|
2023-01-21 16:38:38 +03:00
|
|
|
# otherwise just do an ad-hoc curl.
|
|
|
|
# However, if we are called from within a GH actions workflow (BUILD_REASON
|
|
|
|
# is set), only use `gh` if GH_TOKEN is also set, otherwise it will refuse
|
|
|
|
# to run.
|
2022-12-22 20:52:42 +03:00
|
|
|
function ghapi() {
|
2023-01-21 16:38:38 +03:00
|
|
|
if hash gh 2>/dev/null && test \( -n "$BUILD_REASON" -a -n "$GH_TOKEN" \) -o -z "$BUILD_REASON"; then
|
2022-12-22 20:52:42 +03:00
|
|
|
gh api $1
|
|
|
|
else
|
|
|
|
curl https://api.github.com$1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ -f /tmp/wezterm.releases.json ]] || ghapi /repos/wez/wezterm/releases > /tmp/wezterm.releases.json
|
|
|
|
[[ -f /tmp/wezterm.nightly.json ]] || ghapi /repos/wez/wezterm/releases/tags/nightly > /tmp/wezterm.nightly.json
|
2021-02-01 04:15:35 +03:00
|
|
|
python3 ci/subst-release-info.py || exit 1
|
|
|
|
python3 ci/generate-docs.py || exit 1
|
2019-12-30 08:24:08 +03:00
|
|
|
|
2023-03-16 05:22:51 +03:00
|
|
|
# Adjust path to pick up pip-installed binaries
|
|
|
|
PATH="$HOME/.local/bin;$PATH"
|
2023-03-16 08:56:44 +03:00
|
|
|
|
|
|
|
PIP=pip3
|
|
|
|
if ! hash pip3 >/dev/null ; then
|
|
|
|
PIP=pip
|
|
|
|
fi
|
|
|
|
|
2023-03-21 07:29:43 +03:00
|
|
|
$PIP install --quiet mkdocs-material mkdocs-git-revision-date-localized-plugin black mkdocs-exclude mkdocs-include-markdown-plugin mkdocs-macros-plugin
|
2023-03-16 05:22:51 +03:00
|
|
|
if test -n "${CARDS}" ; then
|
2023-03-16 08:56:44 +03:00
|
|
|
$PIP install --quiet pillow cairosvg
|
2023-03-16 05:22:51 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
black ci/generate-docs.py ci/subst-release-info.py
|
|
|
|
|
|
|
|
cp "assets/icon/terminal.png" docs/favicon.png
|
|
|
|
cp "assets/icon/wezterm-icon.svg" docs/favicon.svg
|
2023-03-16 09:36:23 +03:00
|
|
|
mkdir -p docs/fonts
|
2023-03-16 05:22:51 +03:00
|
|
|
cp assets/fonts/Symbols-Nerd-Font-Mono.ttf docs/fonts/
|
|
|
|
|
2023-03-22 00:44:13 +03:00
|
|
|
if [ "$SERVE" == "yes" ] ; then
|
|
|
|
mkdocs "$@"
|
|
|
|
else
|
|
|
|
mkdocs build
|
|
|
|
fi
|