Skip to content

ci(release): skip publish + PyPI upload when there is no release - #13

Merged
codemug merged 1 commit into
mainfrom
ci/release-guard-no-op
Aug 5, 2026
Merged

ci(release): skip publish + PyPI upload when there is no release#13
codemug merged 1 commit into
mainfrom
ci/release-guard-no-op

Conversation

@codemug

@codemug codemug commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Make the Release job tolerate no-release pushes

Problem

Merging #12 (a ci: commit) turned the Release run red:

No release will be made, 1.4.0 has already been released!
ERROR InvalidDistribution: Cannot find file (or expand pattern): 'dist/*'

semantic-release builds dist/ via its build_command (uv build) only when a release is
warranted
. A no-release push (any ci / docs / chore / style commit) leaves dist/ empty,
but the job then unconditionally runs twine upload dist/*, which fails on the empty glob. This is a
latent gap — the first non-version-bumping commit to land on main would always have hit it.

Fix

Guard the publish + PyPI upload on a non-empty dist/:

uv run semantic-release --verbose version
if [ -d dist ] && [ -n "$(ls -A dist 2>/dev/null)" ]; then
  uv run semantic-release --verbose publish
  uv run twine upload dist/* --verbose
else
  echo "No release for these commits; skipping GitHub asset upload + PyPI publish."
fi
  • Real release (feat/fix): version runs uv builddist/ populated → publish + PyPI upload
    run exactly as before. No behavior change.
  • No-release push: dist/ empty → publish/upload skipped → the job exits green.

Verified: YAML parses; the guard skips on both a missing and an empty dist/, and publishes when a
wheel is present.

Side benefit

Once this lands and the Release run for main concludes success, the new
docker-publish workflow (from #12) fires on workflow_run completion and publishes the first
ghcr.io/codemug/aiofmp-mcp-server image (1.4.0 + latest) — which was skipped while the Release
run was failing.

🤖 Generated with Claude Code

A no-release push to main (ci/docs/chore/style commits) makes semantic-release
build no dist/, so the unconditional `twine upload dist/*` failed with
'Cannot find file (or expand pattern): dist/*'. Guard the publish + upload on
a non-empty dist/ so the Release job succeeds cleanly when no version is cut.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codemug
codemug merged commit b74b3c8 into main Aug 5, 2026
1 check passed
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