From 0cc06076128949973e7c0676e694c68c15fef8f6 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:49:14 +0100 Subject: [PATCH] MAINT: implement CD for ComPWA/actions@v1.3 (#337) --- src/compwa_policy/.github/workflows/cd.yml | 16 ++++++++++++++-- .../check_dev_files/github_workflows.py | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/compwa_policy/.github/workflows/cd.yml b/src/compwa_policy/.github/workflows/cd.yml index 925b84d6..54ae3bc8 100644 --- a/src/compwa_policy/.github/workflows/cd.yml +++ b/src/compwa_policy/.github/workflows/cd.yml @@ -10,10 +10,22 @@ jobs: milestone: if: startsWith(github.ref, 'refs/tags') uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1 + package-name: + uses: ComPWA/actions/.github/workflows/get-pypi-name.yml@v1 pypi: + environment: + name: PyPI + url: https://pypi.org/p/${{ needs.package-name.outputs.name }} if: startsWith(github.ref, 'refs/tags') - secrets: inherit - uses: ComPWA/actions/.github/workflows/publish-to-pypi.yml@v1 + name: Publish to PyPI + needs: + - package-name + permissions: + id-token: write + runs-on: ubuntu-22.04 + steps: + - uses: ComPWA/actions/build-pypi-distribution@v1 + - uses: pypa/gh-action-pypi-publish@release/v1 push: if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease secrets: inherit diff --git a/src/compwa_policy/check_dev_files/github_workflows.py b/src/compwa_policy/check_dev_files/github_workflows.py index 1faf46aa..f57d94bf 100644 --- a/src/compwa_policy/check_dev_files/github_workflows.py +++ b/src/compwa_policy/check_dev_files/github_workflows.py @@ -70,6 +70,7 @@ def update() -> None: workflow_path = CONFIG_PATH.github_workflow_dir / "cd.yml" expected_data = yaml.load(COMPWA_POLICY_DIR / workflow_path) if no_pypi or get_build_system() is None: + del expected_data["jobs"]["package-name"] del expected_data["jobs"]["pypi"] if no_version_branches: del expected_data["jobs"]["push"]