From 4be7f4993941e6feb67e001225f1b627bdc0a57f Mon Sep 17 00:00:00 2001 From: Jae-Won Chung Date: Mon, 30 Sep 2024 16:20:18 -0400 Subject: [PATCH] [Docs] Add `BUILD_SOCIAL_CARD` env, skip social card build by default (#130) --- .github/workflows/check_homepage_build.yaml | 2 ++ .github/workflows/deploy_homepage.yaml | 2 ++ mkdocs.yml | 1 + scripts/preview_docs.sh | 4 ++++ 4 files changed, 9 insertions(+) diff --git a/.github/workflows/check_homepage_build.yaml b/.github/workflows/check_homepage_build.yaml index 2adcef31..30204a70 100644 --- a/.github/workflows/check_homepage_build.yaml +++ b/.github/workflows/check_homepage_build.yaml @@ -38,3 +38,5 @@ jobs: run: pip install '.[docs]' - name: Build homepage run: mkdocs build --verbose --strict + env: + BUILD_SOCIAL_CARD: true diff --git a/.github/workflows/deploy_homepage.yaml b/.github/workflows/deploy_homepage.yaml index e39ea516..c6d409ab 100644 --- a/.github/workflows/deploy_homepage.yaml +++ b/.github/workflows/deploy_homepage.yaml @@ -37,3 +37,5 @@ jobs: run: pip install '.[docs]' - name: Build homepage run: mkdocs gh-deploy --force + env: + BUILD_SOCIAL_CARD: true diff --git a/mkdocs.yml b/mkdocs.yml index ca0b25d4..72da629c 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -38,6 +38,7 @@ plugins: - search - autorefs - social: + enabled: !ENV [BUILD_SOCIAL_CARD, false] cards_dir: assets/img/social cards_layout_options: background_color: "#f7e96d" diff --git a/scripts/preview_docs.sh b/scripts/preview_docs.sh index 74fb7f5a..24c02faf 100644 --- a/scripts/preview_docs.sh +++ b/scripts/preview_docs.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +# This script builds a local version of the documentation and makes it available at localhost:7777. +# By default it does not build social preview cards. If you want to debug social cards, +# set the environment variable `BUILD_SOCIAL_CARD=true` to this script. + pip list | grep mkdocs-material 2>&1 >/dev/null if [[ ! $? -eq 0 ]]; then