summaryrefslogtreecommitdiff
path: root/ci/release.py
blob: f1e8940c217152f73d62111e9cba84c028a155bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python

from subprocess import check_call
import tempfile
import os, base64

is_master_commit = (
    os.environ["TRAVIS_PULL_REQUEST"] == "false" and
    (os.environ["TRAVIS_BRANCH"] == "master" or os.environ["TRAVIS_TAG"] != "")
)

if is_master_commit:
    check_call(["sbt", "bin/test:assembly"])

    _, tmp = tempfile.mkstemp()

    with open(tmp, "w") as f:
        f.write(base64.b64decode(os.environ["GPG_PRIVATE_KEY_B64"]))

    check_call(["gpg", "--import", tmp])

    check_call([
        "target/bin/mill",
        "mill.scalalib.PublishModule/publishAll",
        "lihaoyi:" + os.environ["SONATYPE_PASSWORD"],
        os.environ["GPG_PASSWORD"],
        "__.publishArtifacts"
        "--release",
        "true"
    ])