Добавить проверку существования версии пакета перед публикацией в Gitea Packages и обновить документацию о переменных окружения
CI / Quality Checks (push) Successful in 12s
CI / Test Suite (push) Successful in 11s
CI / Publish to Gitea Packages (push) Successful in 19s

This commit is contained in:
ВяткинАртём
2026-05-27 17:47:33 +03:00
parent 34fb6d0958
commit f0e635ebe2
3 changed files with 84 additions and 18 deletions
+13 -10
View File
@@ -27,16 +27,19 @@ package-version:
$(UV) run python -c "import tomllib; from pathlib import Path; print(tomllib.loads(Path('pyproject.toml').read_text(encoding='utf-8'))['project']['version'])"
publish-gitea:
@test -n "$$GITEA_PYPI_REPOSITORY_URL" || (echo "GITEA_PYPI_REPOSITORY_URL is required" && exit 1)
@test -n "$$GITEA_PACKAGE_USERNAME" || (echo "GITEA_PACKAGE_USERNAME is required" && exit 1)
@test -n "$$GITEA_PACKAGE_TOKEN" || (echo "GITEA_PACKAGE_TOKEN is required" && exit 1)
@echo "Publishing version $$($(MAKE) --no-print-directory package-version)"
$(UV) build
$(UV) run --with twine twine check dist/*
TWINE_REPOSITORY_URL="$$GITEA_PYPI_REPOSITORY_URL" \
TWINE_USERNAME="$$GITEA_PACKAGE_USERNAME" \
TWINE_PASSWORD="$$GITEA_PACKAGE_TOKEN" \
$(UV) run --with twine twine upload --skip-existing dist/*
@repository_url="$${PYPI_REPOSITORY_URL:-$$GITEA_PYPI_REPOSITORY_URL}"; \
username="$${PACKAGE_USERNAME:-$$GITEA_PACKAGE_USERNAME}"; \
token="$${PACKAGE_TOKEN:-$$GITEA_PACKAGE_TOKEN}"; \
test -n "$$repository_url" || (echo "PYPI_REPOSITORY_URL or GITEA_PYPI_REPOSITORY_URL is required" && exit 1); \
test -n "$$username" || (echo "PACKAGE_USERNAME or GITEA_PACKAGE_USERNAME is required" && exit 1); \
test -n "$$token" || (echo "PACKAGE_TOKEN or GITEA_PACKAGE_TOKEN is required" && exit 1); \
echo "Publishing version $$($(MAKE) --no-print-directory package-version)"; \
$(UV) build; \
$(UV) run --with twine twine check dist/*; \
TWINE_REPOSITORY_URL="$$repository_url" \
TWINE_USERNAME="$$username" \
TWINE_PASSWORD="$$token" \
$(UV) run --with twine twine upload dist/*
clean-branches:
ifeq ($(OS),Windows_NT)