apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: pypi spec: params: - name: build-artifact-path type: string description: Path to the built artifact directory from python-build - name: python-version type: string description: Python version to use (e.g., 3.9, 3.11) default: "3.9" - name: pypi-username type: string description: PyPI username (e.g., __token__ for token-based auth) - name: pypi-password type: string description: PyPI password or token - name: pypi-repository-url type: string description: PyPI repository URL default: https://upload.pypi.org/legacy/ workspaces: - name: source description: Workspace containing the built artifacts steps: - name: upload-to-pypi image: python:$(params.python-version)-slim # python-version을 고정하거나 params로 받을 수 있음 script: | #!/usr/bin/env bash pip install twine twine upload \ --repository-url "$(params.pypi-repository-url)" \ --username "$(params.pypi-username)" \ --password "$(params.pypi-password)" \ "$(params.build-artifact-path)"/* if [ $? -eq 0 ]; then echo "Successfully uploaded to PyPI" else echo "Failed to upload to PyPI" exit 1 fi