Skip to content

Commit 11b4275

Browse files
nikagradkropachev
authored andcommitted
CI: remove dead upload_pypi job from reusable workflow, rename to lib-build.yml
Closes #824. Follow-up to #820. The upload_pypi job in lib-build-and-push.yml was never reachable: none of the four caller workflows pass upload: true. build-push.yml and publish-manually.yml already publish from their own separate jobs (necessary due to how PyPI Trusted Publishing embeds the caller workflow path in the OIDC token). Because the reusable workflow declared 'permissions: id-token: write' for upload_pypi, GitHub's static permission validation forced build-test.yml (a pull_request workflow, which defaults to id-token: none) to also declare id-token: write — granting unnecessary privileges to a job that only builds wheels. Changes: - Rename lib-build-and-push.yml -> lib-build.yml (it only builds now) - Remove upload input and upload_pypi job from the reusable workflow - Remove 'permissions: id-token: write' and 'with: upload: false' from build-test.yml (no longer needed) - Update all callers (build-push.yml, publish-manually.yml, build-pre-release.yml) to reference the new workflow path and drop upload: false from with: blocks - Replace TODO comments in build-push.yml and publish-manually.yml with an explanatory comment: the separate publish job is now intentional design, not a temporary workaround
1 parent ca5b8c2 commit 11b4275

5 files changed

Lines changed: 15 additions & 39 deletions

File tree

.github/workflows/build-pre-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515

1616
jobs:
1717
build-and-publish:
18-
uses: ./.github/workflows/lib-build-and-push.yml
18+
uses: ./.github/workflows/lib-build.yml
1919
with:
2020
python-version: ${{ inputs.python-version }}
2121
target: ${{ inputs.target }}

.github/workflows/build-push.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ on:
1010
jobs:
1111
build-and-publish:
1212
name: "Build wheels"
13-
uses: ./.github/workflows/lib-build-and-push.yml
14-
with:
15-
upload: false
13+
uses: ./.github/workflows/lib-build.yml
1614

17-
# TODO: Remove when https://github.com/pypa/gh-action-pypi-publish/issues/166 is fixed and update build-and-publish.with.upload to ${{ endsWith(github.event.ref, 'scylla') }}
15+
# Publishing is a separate job (not inside the reusable workflow) because PyPI Trusted Publishing
16+
# requires the *caller* workflow path in the OIDC token. A reusable workflow would embed its own
17+
# path instead, causing an `invalid-publisher` error on the PyPI side.
18+
# See: https://github.com/pypa/gh-action-pypi-publish/issues/166
1819
publish:
1920
name: "Publish wheels to PyPi"
2021
if: ${{ endsWith(github.event.ref, 'scylla') }}

.github/workflows/build-test.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,4 @@ jobs:
1818
test-wheels-build:
1919
name: "Test wheels building"
2020
if: "!contains(github.event.pull_request.labels.*.name, 'disable-test-build')"
21-
uses: ./.github/workflows/lib-build-and-push.yml
22-
permissions:
23-
id-token: write
24-
with:
25-
upload: false
21+
uses: ./.github/workflows/lib-build.yml
Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
name: Build and upload to PyPi
1+
name: Build wheels
22

33
on:
44
workflow_call:
55
inputs:
6-
upload:
7-
description: 'Upload to PyPI'
8-
type: boolean
9-
required: false
10-
default: false
11-
126
python-version:
137
description: 'Python version to run on'
148
type: string
@@ -146,12 +140,12 @@ jobs:
146140
if: matrix.target != 'linux-aarch64'
147141
shell: bash
148142
run: |
149-
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build-and-push.yml@refs/heads/master" cibuildwheel --output-dir wheelhouse
143+
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build.yml@refs/heads/master" cibuildwheel --output-dir wheelhouse
150144
151145
- name: Build wheels for linux aarch64
152146
if: matrix.target == 'linux-aarch64'
153147
run: |
154-
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build-and-push.yml@refs/heads/master" CIBW_BUILD="cp3*" cibuildwheel --archs aarch64 --output-dir wheelhouse
148+
GITHUB_WORKFLOW_REF="scylladb/python-driver/.github/workflows/lib-build.yml@refs/heads/master" CIBW_BUILD="cp3*" cibuildwheel --archs aarch64 --output-dir wheelhouse
155149
156150
- uses: actions/upload-artifact@v7
157151
with:
@@ -176,20 +170,3 @@ jobs:
176170
with:
177171
name: source-dist
178172
path: dist/*.tar.gz
179-
180-
upload_pypi:
181-
if: inputs.upload
182-
needs: [build-wheels, build-sdist]
183-
runs-on: ubuntu-24.04
184-
permissions:
185-
id-token: write
186-
187-
steps:
188-
- uses: actions/download-artifact@v8
189-
with:
190-
path: dist
191-
merge-multiple: true
192-
193-
- uses: pypa/gh-action-pypi-publish@release/v1
194-
with:
195-
skip-existing: true

.github/workflows/publish-manually.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,17 @@ on:
3939
jobs:
4040
build-and-publish:
4141
name: "Build wheels"
42-
uses: ./.github/workflows/lib-build-and-push.yml
42+
uses: ./.github/workflows/lib-build.yml
4343
with:
44-
upload: false
4544
python-version: ${{ inputs.python-version }}
4645
ignore_tests: ${{ inputs.ignore_tests }}
4746
target_tag: ${{ inputs.target_tag }}
4847
target: ${{ inputs.target }}
4948

50-
# TODO: Remove when https://github.com/pypa/gh-action-pypi-publish/issues/166 is fixed and update build-and-publish.with.upload to ${{ inputs.upload }}
49+
# Publishing is a separate job (not inside the reusable workflow) because PyPI Trusted Publishing
50+
# requires the *caller* workflow path in the OIDC token. A reusable workflow would embed its own
51+
# path instead, causing an `invalid-publisher` error on the PyPI side.
52+
# See: https://github.com/pypa/gh-action-pypi-publish/issues/166
5153
publish:
5254
name: "Publish wheels to PyPi"
5355
needs: build-and-publish

0 commit comments

Comments
 (0)