name: Developer Meta-package Release on: push: tags: - "v*" jobs: publish-package: runs-on: ubuntu-latest env: GITEA_REPOSITORY: ${{ gitea.repository }} steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: fetch-depth: 0 - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 with: python-version: "3.12" - name: Validate protected release tag and package version run: | python - <<'PY' import os from pathlib import Path import subprocess import tomllib tag = os.environ["GITEA_REF_NAME"] project = tomllib.loads(Path("packages/govoplan-meta/pyproject.toml").read_text(encoding="utf-8"))["project"] if tag != f"v{project['version']}": raise SystemExit("meta-package version does not match the release tag") if subprocess.run(["git", "merge-base", "--is-ancestor", "HEAD", "origin/main"]).returncode: raise SystemExit("release tag is not contained in main") PY - name: Build and publish developer package env: PACKAGE_USERNAME: ${{ secrets.GOVOPLAN_PACKAGE_USERNAME }} PACKAGE_TOKEN: ${{ secrets.GOVOPLAN_PACKAGE_TOKEN }} run: | set -euo pipefail test -n "$PACKAGE_USERNAME" test -n "$PACKAGE_TOKEN" python -m pip install --disable-pip-version-check build==1.5.0 twine==7.0.0 python -m build --wheel --outdir dist packages/govoplan-meta python -m twine check dist/*.whl TWINE_USERNAME="$PACKAGE_USERNAME" TWINE_PASSWORD="$PACKAGE_TOKEN" \ python -m twine upload --non-interactive \ --repository-url https://git.add-ideas.de/api/packages/GovOPlaN/pypi \ dist/*.whl