#!/usr/bin/env python3
import build_aux.tag_version as tag
import aur.packaging as pacaur
import flathub.goflathub as gof

import appimage.build_appimage as aim
from build_aux.build_common import color
import build_aux.build_common as bc

# to ensure that evrything works before scrapping a version number
bc.cmd_run(["cargo", "build", "--release"], cwd="..")

tag.main()
pacaur.generate_and_push()
gof.deploy()
aim.publish()


print(f"{color.GREEN}{color.BOLD}--------------------{color.END}")
print(f"{color.GREEN}{color.BOLD}Publishing on Crate.io {color.END}")
print(f"{color.GREEN}{color.BOLD}--------------------{color.END}")
    
bc.cmd_run(["cargo", "publish"], cwd="sysd-manager-base", on_fail_exit=False)
bc.cmd_run(["cargo", "publish"], cwd="sysd-manager-comcontroler", on_fail_exit=False)
bc.cmd_run(["cargo", "publish"], cwd=".")
