#!/usr/bin/env bash
cd "$FORNIX_FOLDER/main"
rm -rf ./dist
python setup.py sdist bdist_wheel
if [ -d "./dist" ]
then
    stty sane 2>/dev/null
    twine upload dist/*
fi

version="$(python -c '
import setuptools
import toml

# 
# get the data out of the toml file
# 
toml_info = toml.load("../pyproject.toml")
package_info = {**toml_info["tool"]["poetry"], **toml_info["tool"]["extra"]}
print(package_info["version"])
')"

# tag it
git tag "$version"
git push origin "$version"