This commit is contained in:
병준 박 2025-04-09 06:21:54 +00:00
parent e0b813a46a
commit 7937e94b14

View File

@ -1,4 +1,4 @@
apiVersion: tekton.dev/v1 apiVersion: tekton.dev/v1beta1
kind: Task kind: Task
metadata: metadata:
name: pypi name: pypi
@ -7,19 +7,37 @@ spec:
- name: build-artifact-path - name: build-artifact-path
type: string type: string
description: Path to the built artifact directory from python-build 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: workspaces:
- name: source - name: source
description: Workspace containing the built artifacts description: Workspace containing the built artifacts
steps: steps:
- name: upload-to-pypi - name: upload-to-pypi
image: python:$(params.python-version)-slim image: python:$(params.python-version)-slim # python-version을 고정하거나 params로 받을 수 있음
script: | script: |
#!/usr/bin/env bash #!/usr/bin/env bash
pip install twine pip install twine
twine upload --username "__token__" --password "$PYPI_TOKEN" $(params.build-artifact-path)/* twine upload \
env: --repository-url "$(params.pypi-repository-url)" \
- name: PYPI_TOKEN --username "$(params.pypi-username)" \
valueFrom: --password "$(params.pypi-password)" \
secretKeyRef: "$(params.build-artifact-path)"/*
name: pypi-credentials if [ $? -eq 0 ]; then
key: token echo "Successfully uploaded to PyPI"
else
echo "Failed to upload to PyPI"
exit 1
fi