From ef388f9a3961647e7a0b88cff2e57540b463bab6 Mon Sep 17 00:00:00 2001 From: Usman Shahid Date: Thu, 6 Aug 2026 01:08:51 +0400 Subject: [PATCH] ci(release): skip publish + PyPI upload when there is no release 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 --- .github/workflows/release.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 33a9db7..3875a46 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,8 +76,15 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | uv run semantic-release --verbose version - uv run semantic-release --verbose publish - uv run twine upload dist/* --verbose + # `uv build` (semantic-release's build_command) only runs when a release is + # warranted, so a no-release push (ci/docs/chore/style commits) leaves dist/ + # empty. Guard the publish + PyPI upload instead of failing on an empty glob. + 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 release: name: Ensure GitHub Release for Tag