Skip to content

chore: trigger PyPI publish workflow after creating a release#4667

Open
dbrattli wants to merge 1 commit into
mainfrom
fix/trigger-pypi-on-release
Open

chore: trigger PyPI publish workflow after creating a release#4667
dbrattli wants to merge 1 commit into
mainfrom
fix/trigger-pypi-on-release

Conversation

@dbrattli

Copy link
Copy Markdown
Collaborator

Problem

The automated release flow (EasyBuild ShipIt) creates a GitHub release but does not trigger publish-pypi.yml, so the PyPI publish had to be dispatched manually.

Root cause

publish-pypi.yml listens for release: types: [published]. The release is created with gh release create (GithubRelease.fs), authenticated in CI via the default GITHUB_TOKEN. GitHub deliberately suppresses events triggered by GITHUB_TOKEN from starting other workflow runs (to prevent recursive runs) — except workflow_dispatch and repository_dispatch. So the release: published event fires but is silently ignored by downstream workflows.

Fix

After a release is created, explicitly dispatch publish-pypi.yml for the freshly created tag via gh workflow run publish-pypi.yml --ref <tag>. Since workflow_dispatch is one of the two events that can be triggered by GITHUB_TOKEN, this works with the token already present in the workflow — no new PAT/secret needed.

The call sits inside the existing if not releaseExists guard, so it only fires for genuinely new releases, and dispatches against the new tag so dunamai --latest-tag resolves the correct version. No changes to publish-pypi.yml are required (it already has workflow_dispatch).

Note: a local ./build.sh github-release will now also dispatch the PyPI workflow when it creates a release, which is consistent with creating a release meaning "publish all packages".

🤖 Generated with Claude Code

The GitHub release is created with `gh release create` authenticated via
the default GITHUB_TOKEN. GitHub deliberately suppresses the
`release: published` event from triggering other workflows in that case
(to avoid recursive runs), so publish-pypi.yml never ran automatically.

Explicitly dispatch publish-pypi.yml for the freshly created tag.
`workflow_dispatch` is one of the two events that CAN be triggered by
GITHUB_TOKEN, so this needs no additional secret.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli changed the title fix(build): trigger PyPI publish workflow after creating a release chore(build): trigger PyPI publish workflow after creating a release Jun 16, 2026
@dbrattli dbrattli changed the title chore(build): trigger PyPI publish workflow after creating a release chore: trigger PyPI publish workflow after creating a release Jun 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.

1 participant