release: put branches in /branches on the snapshots server

This is a precautionary measure to prevent a clash in case we have a branch
with the same name as a tag. Tags live in the top-level directory, because
these are releases that users will most often access directly.
This commit is contained in:
Aldo Cortesi 2018-03-08 08:18:26 +13:00
parent 5cea2aacb2
commit 3a3299bc61

View File

@ -74,8 +74,10 @@ TAG = os.environ.get("TRAVIS_TAG", os.environ.get("APPVEYOR_REPO_TAG_NAME", None
BRANCH = os.environ.get("TRAVIS_BRANCH", os.environ.get("APPVEYOR_REPO_BRANCH", None)) BRANCH = os.environ.get("TRAVIS_BRANCH", os.environ.get("APPVEYOR_REPO_BRANCH", None))
if TAG: if TAG:
VERSION = TAG VERSION = TAG
UPLOAD_DIR = VERSION
elif BRANCH: elif BRANCH:
VERSION = BRANCH VERSION = BRANCH
UPLOAD_DIR = "branches/%s" % VERSION
else: else:
print("Could not establish build name - exiting." % BRANCH) print("Could not establish build name - exiting." % BRANCH)
sys.exit(0) sys.exit(0)
@ -240,7 +242,7 @@ def upload():
"aws", "s3", "cp", "aws", "s3", "cp",
"--acl", "public-read", "--acl", "public-read",
DIST_DIR + "/", DIST_DIR + "/",
"s3://snapshots.mitmproxy.org/%s/" % VERSION, "s3://snapshots.mitmproxy.org/%s/" % UPLOAD_DIR,
"--recursive", "--recursive",
] ]
) )