From fd7234df1724be2441d1da4ea1cb40b46b173e97 Mon Sep 17 00:00:00 2001 From: Andreas Neumeier Date: Wed, 27 May 2020 08:34:31 +0200 Subject: [PATCH] Latest. --- README.md | 21 ++++++++++++++++++--- entrypoint.py | 11 ++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) 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(" "))