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
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