diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 19768c2..b04bbed 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,8 +4,6 @@ on: push: branches: - 'main' - paths: - - 'src/**' jobs: build-and-publish: @@ -16,11 +14,22 @@ jobs: url: https://pypi.org/p/cwapi3d permissions: id-token: write + contents: read steps: - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: dorny/paths-filter@v4.0.1 + id: changes + with: + filters: | + src: + - 'src/**' + - if: steps.changes.outputs.src == 'true' + uses: actions/setup-python@v6 with: python-version: '3.14' - - run: pip install build - - run: python -m build - - uses: pypa/gh-action-pypi-publish@release/v1.14 + - if: steps.changes.outputs.src == 'true' + run: pip install build + - if: steps.changes.outputs.src == 'true' + run: python -m build + - if: steps.changes.outputs.src == 'true' + uses: pypa/gh-action-pypi-publish@release/v1.14 diff --git a/.github/workflows/test_publish.yml b/.github/workflows/test_publish.yml index 96c4a44..15ced31 100644 --- a/.github/workflows/test_publish.yml +++ b/.github/workflows/test_publish.yml @@ -4,8 +4,6 @@ on: push: branches-ignore: - 'main' - paths: - - 'src/**' jobs: build-and-publish: @@ -16,14 +14,25 @@ jobs: url: https://test.pypi.org/p/cwapi3d permissions: id-token: write + contents: read steps: - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: dorny/paths-filter@v4.0.1 + id: changes + with: + filters: | + src: + - 'src/**' + - if: steps.changes.outputs.src == 'true' + uses: actions/setup-python@v6 with: python-version: '3.14' - - run: pip install build - - run: python -m build - - uses: pypa/gh-action-pypi-publish@release/v1.14 + - if: steps.changes.outputs.src == 'true' + run: pip install build + - if: steps.changes.outputs.src == 'true' + run: python -m build + - if: steps.changes.outputs.src == 'true' + uses: pypa/gh-action-pypi-publish@release/v1.14 with: repository-url: https://test.pypi.org/legacy/ skip-existing: true