Skip to content

Commit

Permalink
Add mkdocs_update_latest bool input (#188)
Browse files Browse the repository at this point in the history
For CD - Release workflow to determine whether or not to update and
release the 'latest' "version" according to the `release_branch`.
  • Loading branch information
CasperWA committed Oct 4, 2023
1 parent f21a8c5 commit 1ac1466
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/cd_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ on:
type: string
default: ""

# MkDocs
mkdocs_update_latest:
description: "Whether or not to update the 'latest' alias to point to `release_branch`. Defaults to 'true'."
required: false
type: boolean
default: true

# Sphinx
sphinx-build_options:
description: "Single (space-separated) or multi-line string of command-line options to use when calling `sphinx-build`."
Expand Down Expand Up @@ -384,8 +391,13 @@ jobs:
if [ "${{ inputs.test }}" == "true" ]; then
if [ "${{ inputs.docs_framework }}" == "mkdocs" ]; then
echo "Will here deploy documentation using 'mike', first one called '${REF#v}' with alias 'stable'"
echo "Then one called 'latest' with alias '${{ inputs.release_branch }}'"
echo "Will here deploy documentation using 'mike': '${REF#v}' with alias 'stable'"
echo "Release 'latest': ${{ inputs.mkdocs_update_latest }}"
if [ "${{ inputs.mkdocs_update_latest }}" == "true" ]; then
echo " Another release: 'latest' with alias '${{ inputs.release_branch }}'"
else
echo " No other release."
fi
elif [ "${{ inputs.docs_framework }}" == "sphinx" ]; then
echo "Will here deploy documentation using 'sphinx-build'."
echo "sphinx-build options: ${SPHINX_OPTIONS[@]}"
Expand All @@ -399,7 +411,9 @@ jobs:
elif [ "${{ inputs.docs_framework }}" == "mkdocs" ]; then
mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml ${REF#v} stable
mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest ${{ inputs.release_branch }}
if [ "${{ inputs.mkdocs_update_latest }}" == "true" ]; then
mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest ${{ inputs.release_branch }}
fi
elif [ "${{ inputs.docs_framework }}" == "sphinx" ]; then
sphinx-build \
Expand Down
12 changes: 9 additions & 3 deletions docs/workflows/cd_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Inputs related to updating the version, building and releasing the Python packag
|:--- |:--- |:---:|:---:|:---:|
| `python_package` | Whether or not this is a Python package, where the version should be updated in the `'package_dir'/__init__.py` for the possibly several 'package_dir' lines given in the `package_dirs` input and a build and release to PyPI should be performed. | No | `true` | _boolean_ |
| `python_version_build` | The Python version to use for the workflow when building the package. | No | 3.9 | _string_ |
| `package_dirs` | A multi-line string of paths to Python package directories relative to the repository directory to have its `__version__` value updated.</br></br>Example: `'src/my_package'`.</br></br>**Important**: This is _required_ if 'python_package' is 'true', which is the default.</br></br>See also [Single vs multi-line input](index.md#single-vs-multi-line-input). | **_Yes_ (if 'python_package' is 'true'** | | _string_ |
| `package_dirs` | A multi-line string of paths to Python package directories relative to the repository directory to have its `__version__` value updated.</br></br>Example: `'src/my_package'`.</br></br>**Important**: This is _required_ if 'python_package' is 'true', which is the default.</br></br>See also [Single vs multi-line input](index.md#single-vs-multi-line-input). | **_Yes_ (if 'python_package' is 'true')** | | _string_ |
| `version_update_changes` | A multi-line string of changes to be implemented in the repository files upon updating the version. The string should be made up of three parts: 'file path', 'pattern', and 'replacement string'. These are separated by the 'version_update_changes_separator' value.</br>The 'file path' must _always_ either be relative to the repository root directory or absolute.</br>The 'pattern' should be given as a 'raw' Python string.</br></br>See also [Single vs multi-line input](index.md#single-vs-multi-line-input). | No | _Empty string_ | _string_ |
| `version_update_changes_separator` | The separator to use for 'version_update_changes' when splitting the three parts of each string. | No | , | _string_ |
| `build_libs` | A space-separated list of packages to install via PyPI (`pip install`). | No | _Empty string_ | _string_ |
Expand All @@ -92,7 +92,7 @@ Inputs related to updating the version, building and releasing the Python packag
| `changelog_exclude_labels` | Comma-separated list of labels to exclude from the CHANGELOG.md. | No | _Empty string_ | _string_ |
| `publish_on_pypi` | Whether or not to publish on PyPI.</br></br>**Note**: This is only relevant if 'python_package' is 'true', which is the default. | No | `true` | _boolean_ |

Inputs related to building and releasing the documentation.
Inputs related to building and releasing the documentation in general.

| **Name** | **Description** | **Required** | **Default** | **Type** |
|:--- |:--- |:---:|:---:|:---:|
Expand All @@ -102,7 +102,13 @@ Inputs related to building and releasing the documentation.
| `docs_framework` | The documentation framework to use. This can only be either `'mkdocs'` or `'sphinx'`. | No | mkdocs | _string_ |
| `system_dependencies` | A single (space-separated) or multi-line string of Ubuntu APT packages to install prior to building the documentation.</br></br>See also [Single vs multi-line input](index.md#single-vs-multi-line-input). | No | _Empty string_ | _string_ |

Finally, inputs related _only_ to the Sphinx framework when building and releasing the documentation.
Inputs related _only_ to the **MkDocs** framework.

| **Name** | **Description** | **Required** | **Default** | **Type** |
|:--- |:--- |:---:|:---:|:---:|
| `mkdocs_update_latest` | Whether or not to update the 'latest' alias to point to `release_branch`. | No | `true` | _boolean_ |

Finally, inputs related _only_ to the **Sphinx** framework.

| **Name** | **Description** | **Required** | **Default** | **Type** |
|:--- |:--- |:---:|:---:|:---:|
Expand Down

0 comments on commit 1ac1466

Please sign in to comment.