def publish_release(name, user, token, folder, version, out, zip):
    auth = base64.b64encode((user + ":" + token).encode())
    pwd = os.getcwd()
    os.chdir(folder)
    p = subprocess.Popen(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE)
    sys_out, sys_err = p.communicate()
    assert sys_out is not None, \
        "Problem while accessing git commit sha. Is the folder also the local github repository?"
    assert len(sys_out.strip()) != 0, \
        "Problem while accessing git commit sha. Is the folder also the local github repository?"
    git_sha1 = sys_out.strip()
    # -1 because prompt is one based, whereas the website is zero based.
    license_id = get_license_id() - 1
    os.chdir(pwd)
    if zip is None:
        zip = zip_artifact(folder, name, version, out)
    binary_zip = ""
    if zip is not None:
        with open(zip, 'rb') as f:
            binary_zip = base64.b64encode(f.read())
    artifact_zip = StringIO(binary_zip.decode("utf-8"))
    url = "http://spark-packages.org/api/submit-release"
    params = {"git_commit_sha1": git_sha1,
              "version": version,
              "license_id": license_id,
              "name": name}
    f = {"artifact_zip": artifact_zip}
    h = {"Authorization": "Basic " + auth.decode("utf-8")}
    resp = requests.post(url, headers=h, data=params, files=f)
    if resp.status_code == 201:
        print("\nSUCCESS: %s" % resp.text)
    else:
        print("\nERROR: %s" % resp.text)

# <----- util Methods ------>
dataset/ETHPy150Open databricks/spark-package-cmd-tool/python/spark_package/spark_package.py/publish_release/original