Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker-container-action with build-args #64

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM sphinxdoc/sphinx:2.4.4
ARG SPHINX_TAG=latest
FROM sphinxdoc/sphinx:${SPHINX_TAG}

LABEL "maintainer"="Ammar Askar <[email protected]>"

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- uses: ammaraskar/sphinx-action@master
with:
docs-folder: "docs/"
sphinx-tag: "latest"
```

* If you have any Python dependencies that your project needs (themes,
Expand All @@ -43,6 +44,9 @@ folder.
* If you have multiple sphinx documentation folders, please use multiple
`uses` blocks.

* If you wish to use a specific version of Sphinx, edit the `sphinx-tag` line in the configuration
above.

For a full example repo using this action including advanced usage, take a look
at https://github.com/ammaraskar/sphinx-action-test

Expand Down
22 changes: 20 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ inputs:
The folder containing your sphinx docs.
required: true
default: "docs/"
sphinx-tag:
description:
The tag to use for sphinxdoc/sphinx.
required: false
default: "2.4.4"
build-command:
description:
The command used to build your documentation.
Expand All @@ -22,5 +27,18 @@ inputs:
"apt-get update -y && apt-get install -y perl"
required: false
runs:
using: 'docker'
image: 'Dockerfile'
using: 'composite'
steps:
- id: github
name: Infer GitHub action repository and ref from GitHub action path
uses: ipdxco/docker-container-action/.github/actions/github@v1
- uses: ipdxco/docker-container-action@v1
env:
INPUT_DOCS-FOLDER: ${{ inputs.docs-folder }}
INPUT_BUILD-COMMAND: ${{ inputs.build-command }}
INPUT_PRE-BUILD-COMMAND: ${{ inputs.pre-build-command }}
with:
repository: ${{ steps.github.outputs.action_repository }}
ref: ${{ steps.github.outputs.action_ref }}
build-args: |
SPHINX_TAG:${{ inputs.sphinx-tag }}
5 changes: 3 additions & 2 deletions entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

if "INPUT_PRE-BUILD-COMMAND" in os.environ:
pre_command = os.environ["INPUT_PRE-BUILD-COMMAND"]
print("Running: {}".format(pre_command))
os.system(pre_command)
if len (pre_command) > 0: # Check for empty string
print("Running: {}".format(pre_command))
os.system(pre_command)

github_env = action.GithubEnvironment(
build_command=os.environ.get("INPUT_BUILD-COMMAND"),
Expand Down