import os
import subprocess


def get_current_version():
    if "VERSION" in os.environ:
        return os.environ["VERSION"]

    try:
        output = subprocess.check_output(
            ["git", "describe", "--tags"], universal_newlines=True
        )
        return output.strip()
    except (subprocess.CalledProcessError, OSError):
        return ""
