diff --git a/tasks/pypi/task.yaml b/tasks/pypi/task.yaml index 9874942..d3add97 100644 --- a/tasks/pypi/task.yaml +++ b/tasks/pypi/task.yaml @@ -1,4 +1,4 @@ -apiVersion: tekton.dev/v1 +apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: pypi @@ -7,19 +7,37 @@ spec: - 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 + image: python:$(params.python-version)-slim # python-version을 고정하거나 params로 받을 수 있음 script: | #!/usr/bin/env bash pip install twine - twine upload --username "__token__" --password "$PYPI_TOKEN" $(params.build-artifact-path)/* - env: - - name: PYPI_TOKEN - valueFrom: - secretKeyRef: - name: pypi-credentials - key: token + 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 \ No newline at end of file