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