#!/bin/bash
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Copyright (C) 2026 Guillaume Tucker

set -eo pipefail

# Workaround: drop [api] deps as they include downstream fixes from GitHub
# https://gitlab.com/gtucker.io/renelick/-/work_items/195  uvicorn
# https://gitlab.com/gtucker.io/renelick/-/work_items/58   starlette
python -c "import toml; f = open('pyproject.toml'); d = toml.load(f); del d['project']['optional-dependencies']['api']; f = open('pyproject.toml', 'w'); toml.dump(d, f)"

rm -rf dist
python -m build
python -m twine upload --verbose dist/*

# Workaround clean-up
git checkout pyproject.toml

exit 0
