diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2703e43b1..50df95595 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -25,6 +25,7 @@ jobs: secrets: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + publish-docs: needs: - build-and-publish diff --git a/doc/changes/unreleased.md b/doc/changes/unreleased.md index fb4737052..9f9516f0c 100644 --- a/doc/changes/unreleased.md +++ b/doc/changes/unreleased.md @@ -1,3 +1,8 @@ # Unreleased ## Summary + + +## Feature + +* #730: Added support to extend GitHub workflow `cd.yml` diff --git a/doc/user_guide/features/github_workflows/index.rst b/doc/user_guide/features/github_workflows/index.rst index 0e699d9a8..439d039f4 100644 --- a/doc/user_guide/features/github_workflows/index.rst +++ b/doc/user_guide/features/github_workflows/index.rst @@ -56,9 +56,8 @@ Maintained by the PTB - Packages the distribution and publishes it to PyPi and GitHub. * - ``cd.yml`` - Push with new tag - - Manages continuous delivery by calling ``check-release-tag.yml``, - ``build-and-publish.yml``, and ``gh-pages.yml``. See :ref:`cd_yml` - for a graph of workflow calls. + - Manages continuous delivery by creating and uploading build artifacts and + documentation. See :ref:`cd_yml` for a graph of workflow calls. * - ``check-release-tag.yml`` - Workflow call - Verifies that the release tag matches the project's internal versioning. @@ -148,6 +147,9 @@ and is maintained by the PTB and what is project-specific. * - ``fast-tests-extension.yml`` - Workflow call - This extends the ``fast-tests.yml`` and should include additional fast tests. + * - ``cd-extension.yml`` + - Workflow call + - This extends the ``cd.yml``. Use it to add project-specific release steps. * - ``merge-gate-extension.yml`` - Workflow call - This extends the ``merge-gate.yml`` and the ``needs`` criteria of the job @@ -260,6 +262,7 @@ to main. This starts the release process by activating the ``cd.yml`` workflow. graph TD %% Workflow Triggers (Solid Lines) cd[cd.yml] --> check-release-tag[check-release-tag.yml] + cd --> cd-extension[cd-extension.yml] %% Dependencies / Waiting (Dotted Lines) check-release-tag -.->|needs| build-and-publish[build-and-publish.yml] diff --git a/exasol/toolbox/config.py b/exasol/toolbox/config.py index 16370a65f..1c67d7f54 100644 --- a/exasol/toolbox/config.py +++ b/exasol/toolbox/config.py @@ -299,6 +299,7 @@ def github_template_dict(self) -> dict[str, Any]: Dictionary of variables to dynamically render Jinja2 templates into valid YAML configurations. """ + cd_extension = self.github_workflow_directory / "cd-extension.yml" fast_tests_extension = ( self.github_workflow_directory / "fast-tests-extension.yml" ) @@ -314,6 +315,7 @@ def github_template_dict(self) -> dict[str, Any]: "sonar_token_name": self.sonar_token_name, "workflow_header": f"{WORKFLOW_HEADER_PREFIX}{__version__}.", "workflow_extension": { + "cd": cd_extension.is_file(), "fast_tests": fast_tests_extension.is_file(), "merge_gate": merge_gate_extension.is_file(), }, diff --git a/exasol/toolbox/templates/github/workflows/cd.yml b/exasol/toolbox/templates/github/workflows/cd.yml index 53c1e332c..821c4974f 100644 --- a/exasol/toolbox/templates/github/workflows/cd.yml +++ b/exasol/toolbox/templates/github/workflows/cd.yml @@ -24,6 +24,14 @@ jobs: secrets: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + (% if workflow_extension.cd %) + cd-extension: + uses: ./.github/workflows/cd-extension.yml + secrets: inherit + permissions: + contents: write + (% endif %) + publish-docs: needs: - build-and-publish diff --git a/test/unit/config_test.py b/test/unit/config_test.py index 770c6c2a3..cf931fe03 100644 --- a/test/unit/config_test.py +++ b/test/unit/config_test.py @@ -59,7 +59,11 @@ def test_works_as_defined(tmp_path, test_project_config_factory): "3.13", "3.14", ), - "workflow_extension": {"fast_tests": False, "merge_gate": False}, + "workflow_extension": { + "cd": False, + "fast_tests": False, + "merge_gate": False, + }, }, "minimum_python_version": "3.10", "os_version": "ubuntu-24.04",