version format: 0.5.1
(v: str)
| 66 | |
| 67 | |
| 68 | def build(v: str): |
| 69 | """version format: 0.5.1""" |
| 70 | logger.info("Start to prepare release artifacts for version %s", v) |
| 71 | _check_release_version(v) |
| 72 | os.chdir(PROJECT_ROOT_DIR) |
| 73 | if os.path.exists("dist"): |
| 74 | shutil.rmtree("dist") |
| 75 | os.mkdir("dist") |
| 76 | branch = f"releases-{v}" |
| 77 | # Check if branch exists, if not create it |
| 78 | result = subprocess.run( |
| 79 | f"git show-ref --verify --quiet refs/heads/{branch}", |
| 80 | shell=True, |
| 81 | capture_output=True, |
| 82 | ) |
| 83 | if result.returncode == 0: |
| 84 | # Branch exists, checkout |
| 85 | subprocess.check_call(f"git checkout {branch}", shell=True) |
| 86 | else: |
| 87 | # Branch doesn't exist, create it |
| 88 | subprocess.check_call(f"git checkout -b {branch}", shell=True) |
| 89 | src_tar = f"apache-fory-{v}-src.tar.gz" |
| 90 | _check_all_committed() |
| 91 | _strip_unnecessary_license() |
| 92 | subprocess.check_call( |
| 93 | "git add LICENSE && git commit -m 'remove benchmark from license'", shell=True |
| 94 | ) |
| 95 | subprocess.check_call( |
| 96 | f"git archive --format=tar.gz " |
| 97 | f"--output=dist/{src_tar} " |
| 98 | f"--prefix=apache-fory-{v}-src/ {branch}", |
| 99 | shell=True, |
| 100 | ) |
| 101 | subprocess.check_call("git reset --hard HEAD~", shell=True) |
| 102 | os.chdir("dist") |
| 103 | logger.info("Start to generate signature") |
| 104 | subprocess.check_call( |
| 105 | f"gpg --armor --output {src_tar}.asc --detach-sig {src_tar}", shell=True |
| 106 | ) |
| 107 | subprocess.check_call(f"sha512sum {src_tar} >{src_tar}.sha512", shell=True) |
| 108 | verify(v) |
| 109 | |
| 110 | |
| 111 | def _check_release_version(v: str): |
no test coverage detected