diff --git a/README.md b/README.md index 34982f1..7d4fc2b 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ https://www.mkdocs.org/user-guide/deploying-your-docs/#custom-domains This action supports deployment of mkdocs with different file path , if you populate a `CONFIG_FILE` environment variable. This is important if you have mkdocs file in another folder such as if you have `mkdocs.yml` in a path `docs/mkdocs.yml`. Without populating this, the deployment assumes that `mkdocs.yml` is on the root folder. +### Requirements.txt + +This action supports installation of `requirements.txt` for custom installations on the mkdocs package such as installation of mermaid markdown which is not present as part of the mkdocs base extensions. If you populate a `REQUIREMENTS` environment variable with a path, the action will install the file being pointed by the environment variable. + ## Example usage ```shell @@ -56,4 +60,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CUSTOM_DOMAIN: optionaldomain.com CONFIG_FILE: folder/mkdocs.yml + REQUIREMENTS: folder/requirements.txt ``` diff --git a/action.sh b/action.sh index 30a6460..0080b0a 100644 --- a/action.sh +++ b/action.sh @@ -6,14 +6,9 @@ function print_info() { echo -e "\e[36mINFO: ${1}\e[m" } -if [ -n "${REQUIREMENTS}" ] && [ -f "${GITHUB_WORKSPACE}/${REQUIREMENTS}" ]; then - pip install -r "${GITHUB_WORKSPACE}/${REQUIREMENTS}" -else - REQUIREMENTS="${GITHUB_WORKSPACE}/requirements.txt" - if [ -f "${REQUIREMENTS}" ]; then - pip install -r "${REQUIREMENTS}" - fi -fi +if [ -f "${GITHUB_WORKSPACE}/${REQUIREMENTS}" ]; then + pip install -r "${GITHUB_WORKSPACE}/${REQUIREMENTS}" +fi if [ -n "${CUSTOM_DOMAIN}" ]; then print_info "Setting custom domain for github pages"