Skip to content

Commit bb8b4b3

Browse files
authored
ci: Add skip to publish if not package was made
Added a step to check if the 'dist' directory exists before publishing.
1 parent 208c35c commit bb8b4b3

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@ jobs:
2626
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
run: uv run semantic-release version
2828

29+
- name: Check if dist directory exists
30+
id: check_dist
31+
run: |
32+
if [ -d "dist" ]; then
33+
echo "exists=true" >> $GITHUB_OUTPUT
34+
else
35+
echo "exists=false" >> $GITHUB_OUTPUT
36+
fi
37+
2938
- name: Publish to PyPI
39+
if: steps.check_dist.outputs.exists == 'true'
3040
uses: pypa/gh-action-pypi-publish@release/v1
3141
with:
3242
packages-dir: dist/
3343

3444
- name: Publish GitHub Release
45+
if: steps.check_dist.outputs.exists == 'true'
3546
env:
3647
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3748
run: uv run semantic-release publish

0 commit comments

Comments
 (0)