Skip to content

ci: publish DB12 to PyPI via trusted publisher - #18

Merged
aldbr merged 10 commits into
DIRACGrid:masterfrom
fstagni:pypi-trusted-publisher
Nov 16, 2026
Merged

aldbr merged 10 commits into
DIRACGrid:masterfrom
fstagni:pypi-trusted-publisher

Conversation

@fstagni

@fstagni fstagni commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Part of DIRACGrid/.github#5 (PyPI releases / trusted publisher instead of PYPI_TOKEN), same as DIRACGrid/DIRAC#8886.

pypi-publish.yml is split in two:

  • build builds the wheel/sdist, uploads them as an artifact on tag pushes, and needs no PyPI credential (permissions: {} at workflow level, contents: read for the job). The duplicated checkout step is removed.
  • publish downloads the packages and publishes them with trusted publishing (environment: pypi, id-token: write), same as already done in diracx, intercede and signurlarity. PYPI_API_TOKEN is dropped entirely, and pypa/gh-action-pypi-publish is pinned to the same commit SHA used in the other DIRACGrid repos (it was on the mutable master branch). skip_existing is kept.

Required follow-ups before the next release (manual):

  • create the pypi environment on this repository (no reviewers needed)
  • register the trusted publisher on PyPI for the DB12 project: workflow pypi-publish.yml, environment pypi, owner DIRACGrid
  • verify with a release

Comment thread .github/workflows/pypi-publish.yml Resolved
Comment thread .github/workflows/pypi-publish.yml Resolved
Comment thread src/db12/benchmark.py Resolved
Comment thread .github/workflows/pypi-publish.yml Resolved
Comment thread .github/workflows/pypi-publish.yml Resolved
Commit 3fd6127 replaced setup.py with a bare setup() and dropped
use_scm_version, so any build after 1.0.4 is versioned 0.0.0. With the
trusted publisher in place, the next tag would upload DB12 0.0.0 to PyPI.

Restore use_scm_version and declare setuptools_scm in [build-system].
A tagged build now gives the tag (1.0.5 -> db12-1.0.5), also from the
shallow checkout actions/checkout does on a tag push. The wheel contains
the same files as 1.0.4.

Assisted-by: Claude:claude-opus-5-5
The step had no id, nothing read its outputs and it ran after the build,
so it could not skip anything. It needs actions permissions the job no
longer grants (contents: read only): its listWorkflowRuns call is not
wrapped in a try, so a 403 would fail the build job and block publish.
It was also the last action pinned to a mutable @master.

Also use the canonical skip-existing input name (skip_existing is a
deprecated alias in gh-action-pypi-publish).

Assisted-by: Claude:claude-opus-5-5
Initialising start/end for pylint made iterations_num=0 return NORM=0
(and a negative CPU time with measured copies) where it used to raise.
Raise a ValueError up front; for valid inputs the result is unchanged.

Assisted-by: Claude:claude-opus-5-5
- Pin actions/checkout (v7.0.1) and actions/setup-python (v7.1.0) by SHA,
  like the other actions in the workflow. The v2 tags targeted an old
  Node runtime and were force-run on Node 24 with a deprecation warning.
- Set python-version explicitly instead of the implicit 3.x default.
- Label the pypi-publish SHA with its tag (v1.14.3) instead of the
  moving release/v1 branch.
- Drop the redundant needs.build.result check: a job with needs only
  runs when its dependencies succeeded.

Assisted-by: Claude:claude-opus-5-5
@aldbr
aldbr merged commit 8eb9a61 into DIRACGrid:master Nov 16, 2026
17 of 18 checks passed
fstagni added a commit to fstagni/DB12 that referenced this pull request Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants