-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-readme.sh
executable file
·33 lines (27 loc) · 1.24 KB
/
generate-readme.sh
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
#!/bin/bash
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
set -e -x -v -u -o pipefail
SCRIPT_DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
source "${SCRIPT_DIR}/utilities/common.sh"
# NOTE: Use dev requirements to generate the README because the README uses
# shell() with some tools that we only want to install into dev environment.
VENV_PATH="${PWD}/.cache/scripts/.venv" source "${PROJ_PATH}/scripts/utilities/ensure-venv.sh"
TOML=${PROJ_PATH}/pyproject.toml EXTRA=dev \
DEV_VENV_PATH="${PWD}/.cache/scripts/.venv" \
TARGET_VENV_PATH="${PWD}/.cache/scripts/.venv" \
bash "${PROJ_PATH}/scripts/utilities/ensure-reqs.sh"
bash scripts/format.sh
bash scripts/run-all-examples.sh
python -m snipinator.cli \
-t "${PROJ_PATH}/README.md.jinja2" \
--rm \
--force \
--create \
-o "${PROJ_PATH}/README.md" \
--chmod-ro
LAST_VERSION=$(tomlq -r -e '.["tool"]["mdremotifier-project-metadata"]["last_stable_release"]' pyproject.toml)
python -m mdremotifier.cli \
-i "${PROJ_PATH}/README.md" \
--url-prefix "https://github.com/realazthat/mdremotifier/blob/v${LAST_VERSION}/" \
--img-url-prefix "https://raw.githubusercontent.com/realazthat/mdremotifier/v${LAST_VERSION}/" \
-o "${PROJ_PATH}/.github/README.remotified.md"