diff --git a/bin/build.sh b/bin/build.sh index fdeb42c..8d7d2d2 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -1,29 +1,17 @@ #!/usr/bin/env bash -set -e -if [[ $DEBUG != "" ]]; then - set -x -fi +set -xe -_root_directory_git=$(git rev-parse --show-toplevel) TARGET_DIR=${TARGET_DIR:-"$PWD/public"} +FF_OFFLINE_MKDOCS_PLUGIN=${FF_OFFLINE_MKDOCS_PLUGIN:-"false"} +FF_ENABLE_COMMIT_DATA=${FF_ENABLE_COMMIT_DATA:-"true"} +FF_GENERATE_SOCIAL_CARDS=${FF_GENERATE_SOCIAL_CARDS:-"true"} -## source vars from .env first ## -export "$(xargs < "$_root_directory_git/.env")" - -warn() { - echo "warning: $*" -} - -error() { - echo "error: $*" -} - -if [[ ! -d .venv ]]; then - python3 -m venv .venv - "$_root_directory_git/.venv/bin/pip3" install -r requirements.txt --upgrade +if [[ ! -d "$PWD/.venv" && $SKIP_VENV_SETUP == "" ]]; then + python3 -m venv $PWD/.venv fi +$PWD/.venv/bin/pip3 install -r requirements.txt --upgrade +$PWD/.venv/bin/mkdocs build -d $TARGET_DIR +mkdir "$TARGET_DIR/api" +git rev-parse HEAD > "$TARGET_DIR/api/commit" -"$_root_directory_git/.venv/bin/mkdocs" build \ - -d "$TARGET_DIR" \ - --use-directory-urls \ - --verbose \ No newline at end of file +set +xe diff --git a/build.sh b/build.sh deleted file mode 100755 index 8d7d2d2..0000000 --- a/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -set -xe - -TARGET_DIR=${TARGET_DIR:-"$PWD/public"} -FF_OFFLINE_MKDOCS_PLUGIN=${FF_OFFLINE_MKDOCS_PLUGIN:-"false"} -FF_ENABLE_COMMIT_DATA=${FF_ENABLE_COMMIT_DATA:-"true"} -FF_GENERATE_SOCIAL_CARDS=${FF_GENERATE_SOCIAL_CARDS:-"true"} - -if [[ ! -d "$PWD/.venv" && $SKIP_VENV_SETUP == "" ]]; then - python3 -m venv $PWD/.venv -fi -$PWD/.venv/bin/pip3 install -r requirements.txt --upgrade -$PWD/.venv/bin/mkdocs build -d $TARGET_DIR -mkdir "$TARGET_DIR/api" -git rev-parse HEAD > "$TARGET_DIR/api/commit" - -set +xe diff --git a/build.sh b/build.sh new file mode 120000 index 0000000..51686d1 --- /dev/null +++ b/build.sh @@ -0,0 +1 @@ +bin/build.sh \ No newline at end of file