@smbcloud / cli / commits / 9dcaa3f

Skip PyPI publish if release version already exists

Seto Elkahfi committed Apr 6, 2026 at 11:13 UTC 9dcaa3f5f1cb4a6bdc81a466cee4c52dc528cd5a
1 file changed +7 -1
.github/workflows/release-pypi.yml
+7 -1
@@ -198,12 +198,18 @@ jobs:
198 merge-multiple: true
199
200 - name: Check whether release already exists on PyPI
201 + id: pypi-check
202 shell: bash
203 run: |
204 if curl -fsS "https://pypi.org/pypi/smbcloud-cli/${RELEASE_VERSION}/json" >/dev/null 2>&1; then
205 echo "smbcloud-cli ${RELEASE_VERSION} already exists on PyPI, skipping publish"
205 - exit 0
206 + echo "exists=true" >> "$GITHUB_OUTPUT"
207 + else
208 + echo "exists=false" >> "$GITHUB_OUTPUT"
209 fi
210
211 - name: Publish distribution
212 + if: steps.pypi-check.outputs.exists != 'true'
213 uses: pypa/gh-action-pypi-publish@release/v1
214 + with:
215 + skip-existing: true