diff --git a/README.md b/README.md index 25842b5..90588ef 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,20 @@ -# Container Action Template +# doc-build github action -To get started, click the `Use this template` button on this repository [which will create a new repository based on this template](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/). +This action build [sphinx](https://www.sphinx-doc.org/) documentation. -For info on how to build your first Container action, see the [toolkit docs folder](https://github.com/actions/toolkit/blob/master/docs/container-action.md). +## Inputs + +### `docs` + +**Required** The location of the documentation source to build. Default `"docs"`. + +### `dest` + +**Required** The destination directory. Default `"build"`. + +## Example usage + +uses: andreasofthings/doc-build@v13 +with: + docs: 'docs' + dest: 'build' diff --git a/entrypoint.py b/entrypoint.py index 2d0c971..0d7a403 100755 --- a/entrypoint.py +++ b/entrypoint.py @@ -75,13 +75,18 @@ def extract_line_information(line_information: str) -> LineInfo: if __name__=='__main__': logging.debug("[build documentation] Starting documentation-action build.") + input = os.environ.get("INPUT_DOCS", 'docs') + output = os.environ.get("INPUT_DEST", 'build') + + if os.path.exists(os.path.join(input, "requirements.txt")): + import pip + pip.main(['install', "-r", os.path.join(input, "requirements.txt")]) + + logfile = os.path.join(tempfile.gettempdir(), "sphinx-log") if os.path.exists(logfile): os.unlink(logfile) - input = os.environ.get("INPUT_DOCS", 'docs') - output = os.environ.get("INPUT_DEST", 'build') - options = f'--keep-going --no-color -a -q -w {logfile} {input} {output}' main(options.split(" "))