Skip to content

Publish to PyPi

Publish to PyPi #2

Workflow file for this run

name: Publish package
on:
# Automatisch na GitHub Release
release:
types: [published]
# Handmatig starten met keuze
workflow_dispatch:
inputs:
target:
description: "Publish target"
required: true
type: choice
default: testpypi
options:
- testpypi
- pypi
permissions:
contents: read
id-token: write # nodig voor trusted publishing
jobs:
publish:
runs-on: ubuntu-latest
# Dynamisch environment kiezen
environment: ${{ github.event.inputs.target || 'testpypi' }}
steps:
- name: Checkout exact release tag
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build package
run: uv build
- name: Publish to TestPyPI or PyPI
run: |
if [ "${{ github.event.inputs.target }}" = "pypi" ]; then
uv publish --index https://upload.pypi.org/legacy/
else
uv publish --index https://test.pypi.org/legacy/
fi