apiVersion: tekton.dev/v1 kind: Task metadata: name: pypi spec: params: - name: build-artifact-path type: string description: Path to the built artifact directory from python-build - name: pythonImageName type: string description: Python version to use (e.g., 3.9, 3.11) default: "python:3.11-slim" - name: pypi-hosted-url type: string description: PyPI repository URL for upload default: https://upload.pypi.org/legacy/ workspaces: - name: source description: Workspace containing the built artifacts steps: - name: upload-to-pypi image: $(params.pythonImageName) workingDir: /workspace/source env: - name: HOME value: /workspace/source/___HOME___ script: | #!/usr/bin/env bash set -e HOSTED_URL="$(params.pypi-hosted-url)" echo "📦 Installing tools..." pip install --upgrade pip --root-user-action=ignore pip install poetry tomli twine --root-user-action=ignore echo "[INFO] Uploading artifacts to $HOSTED_URL" twine upload \ --repository-url "$HOSTED_URL" \ "$(params.build-artifact-path)"/* echo "[INFO] ✅ Upload to PyPI complete"