Skip to content
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
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ Unless you need to highly customize the action's behavior.
Input Default Required Description
-------------------------- ---------------------------- -------- -------------------------------------------------
``python_version`` ``3.12`` false Version of Python
``installer`` ``pip`` false Which installer to use. Options: ["pip", "uv"]
``sphinx_version`` ``latest`` false Version of Sphinx
``sphinx_build_options`` false Additional options passed to ``sphinx-build``
``cache`` ``false`` false Enable cache to speed up documentation building
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
description: 'Version of Python'
required: false
default: '3.12'
installer:
description: 'Which installer to use. Options: ["pip", "uv"]'
required: false
default: 'pip'
sphinx_version:
description: 'Version of Sphinx'
required: false
Expand Down Expand Up @@ -96,6 +100,7 @@ runs:
INPUT_DOCUMENTATION_PATH: ${{ inputs.documentation_path }}
INPUT_REQUIREMENTS_PATH: ${{ inputs.requirements_path }}
INPUT_PYPROJECT_EXTRAS: ${{ inputs.pyproject_extras }}
INPUT_INSTALLER: ${{ inputs.installer }}
INPUT_SPHINX_VERSION: ${{ inputs.sphinx_version }}
INPUT_CACHE: ${{ inputs.cache }}
INPUT_SPHINX_BUILD_OPTIONS: ${{ inputs.sphinx_build_options }}
Expand Down
26 changes: 21 additions & 5 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,31 @@ echo Documentation: $doc_dir

echo ::endgroup::

# Setup pip or uv
if [ "$INPUT_INSTALLER" == "pip" ]; then
INSTALLER="pip3"
elif [ "$INPUT_INSTALLER" == "uv" ]; then
echo ::group:: Installing uv
pip3 install uv
echo Creating venv
uv venv --allow-existing venv
source venv/bin/activate
INSTALLER="uv pip"
echo ::endgroup::
else
echo "Installer '${INPUT_INSTALLER}' not recognized!"
exit 1
fi

# The actions doesn't depends on any images,
# so we have to try various package manager.
echo ::group:: Installing Sphinx

echo Installing sphinx via pip
if [ -z "$INPUT_SPHINX_VERSION" ] ; then
pip3 install -U sphinx
$INSTALLER install -U sphinx
else
pip3 install -U sphinx==$INPUT_SPHINX_VERSION
$INSTALLER install -U sphinx==$INPUT_SPHINX_VERSION
fi

echo Adding ~/.local/bin to system path
Expand All @@ -37,14 +53,14 @@ else
echo Everything goes well
fi

pip3 install -U sphinxnotes-incrbuild>=1.0
$INSTALLER install -U sphinxnotes-incrbuild>=1.0

echo ::endgroup::

if [ ! -z "$INPUT_REQUIREMENTS_PATH" ] ; then
echo ::group:: Installing dependencies declared by $INPUT_REQUIREMENTS_PATH
if [ -f "$INPUT_REQUIREMENTS_PATH" ]; then
pip3 install -r "$INPUT_REQUIREMENTS_PATH"
$INSTALLER install -r "$INPUT_REQUIREMENTS_PATH"
else
echo No $INPUT_REQUIREMENTS_PATH found, skipped
fi
Expand All @@ -54,7 +70,7 @@ fi
if [ ! -z "$INPUT_PYPROJECT_EXTRAS" ] ; then
echo ::group:: Installing dependencies declared by pyproject.toml[$INPUT_PYPROJECT_EXTRAS]
if [ -f "pyproject.toml" ]; then
pip3 install .[$INPUT_PYPROJECT_EXTRAS]
$INSTALLER install .[$INPUT_PYPROJECT_EXTRAS]
else
echo No pyproject.toml found, skipped
fi
Expand Down