tekton-hub/tasks/pypi/task.yaml
2025-04-15 12:52:11 +00:00

53 lines
1.3 KiB
YAML

apiVersion: tekton.dev/v1
kind: Task
metadata:
name: pypi
spec:
params:
- name: home
type: string
description: home directory
- 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/shared/$(params.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"