separate snapshot and release deploy jobs (#5669)

This commit is contained in:
Maximilian Hils 2022-10-22 14:09:44 +02:00 committed by GitHub
parent be2b9a962e
commit 839115df8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 52 deletions

View file

@ -53,7 +53,11 @@ def wheel():
DIST_DIR,
]
)
(whl,) = DIST_DIR.glob("mitmproxy-*-py3-none-any.whl")
if os.environ.get("GITHUB_REF", "").startswith("refs/tags/"):
ver = version() # assert for tags that the version matches the tag.
else:
ver = "*"
(whl,) = DIST_DIR.glob(f"mitmproxy-{ver}-py3-none-any.whl")
print(f"Found wheel package: {whl}")
subprocess.check_call(["tox", "-e", "wheeltest", "--", whl])
@ -80,12 +84,7 @@ def archive(path: Path) -> tarfile.TarFile | ZipFile2:
def version() -> str:
if ref := os.environ.get("GITHUB_REF", ""):
if ref.startswith("refs/heads/"):
return ref.replace("refs/heads/", "")
if ref.startswith("refs/tags/"):
return ref.replace("refs/tags/", "")
return os.environ.get("BUILD_VERSION", "dev")
return os.environ.get("GITHUB_REF_NAME", "").replace("/", "-") or os.environ.get("BUILD_VERSION", "dev")
def operating_system() -> Literal["windows", "linux", "macos", "unknown"]: