fix(#1): Fix publish step - check simple index for existing version
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Gitea PyPI registry does not support twine --skip-existing. Instead,
curl the simple index page and grep for the version in filenames before
attempting upload. Uses underscore naming (mosaicstack_telemetry) to
match actual sdist/wheel filenames.

Refs #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-14 22:46:57 -06:00
parent 62179042e7
commit f07c911e1a

View File

@@ -70,14 +70,19 @@ steps:
CURRENT=$$(uv run python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "Building version $$CURRENT..."
uv build
echo "Publishing $$CURRENT..."
uv run twine upload \
--repository-url "https://git.mosaicstack.dev/api/packages/mosaic/pypi" \
--username "$$GITEA_USER" \
--password "$$GITEA_TOKEN" \
--skip-existing \
dist/*
echo "Published mosaicstack-telemetry $$CURRENT"
echo "Checking if $$CURRENT is already published..."
INDEX_PAGE=$$(curl -sf "https://git.mosaicstack.dev/api/packages/mosaic/pypi/simple/mosaicstack-telemetry/" 2>/dev/null || echo "")
if echo "$$INDEX_PAGE" | grep -q "mosaicstack_telemetry-$$CURRENT"; then
echo "Version $$CURRENT already published, skipping upload"
else
echo "Publishing $$CURRENT..."
uv run twine upload \
--repository-url "https://git.mosaicstack.dev/api/packages/mosaic/pypi" \
--username "$$GITEA_USER" \
--password "$$GITEA_TOKEN" \
dist/*
echo "Published mosaicstack-telemetry $$CURRENT"
fi
when:
- branch: [main, develop]
event: [push, manual, tag]