This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-fury.git


The following commit(s) were added to refs/heads/main by this push:
     new 66b75980 feat: add source release/verify script (#1535)
66b75980 is described below

commit 66b759805f633f080d6a51e6d2a785910f6535d8
Author: Shawn Yang <[email protected]>
AuthorDate: Fri Apr 19 17:20:43 2024 +0800

    feat: add source release/verify script (#1535)
---
 ci/release.py | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/ci/release.py b/ci/release.py
index 160cac3b..d3993081 100644
--- a/ci/release.py
+++ b/ci/release.py
@@ -17,13 +17,56 @@
 
 
 import argparse
+import logging
 import os
 import re
+import shutil
 import subprocess
 
+logging.basicConfig(level=logging.INFO)
+logger = logging.getLogger(__name__)
+
 PROJECT_ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 
"../")
 
 
+def build(v: str):
+    """version format: 0.5.0"""
+    assert v
+    logger.info("Start to prepare release artifacts for version %s", v)
+    if "rc" in v:
+        raise ValueError(
+            "RC should only be contained in tag and svn directory, not in code"
+        )
+    os.chdir(PROJECT_ROOT_DIR)
+    if os.path.exists("dist"):
+        shutil.rmtree("dist")
+    os.mkdir("dist")
+    subprocess.check_call(f"git checkout releases-{v}", shell=True)
+    branch = f"releases-{v}"
+    src_tar = f"apache-fury-incubating-{v}-src.tar.gz"
+    subprocess.check_call(
+        f"git archive --format=tar.gz "
+        f"--output=dist/{src_tar} "
+        f"--prefix=apache-fury-incubating-{v}-src/ {branch}",
+        shell=True,
+    )
+    os.chdir("dist")
+    logger.info("Start to generate signature")
+    subprocess.check_call(
+        f"gpg --armor --output {src_tar}.asc --detach-sig {src_tar}", 
shell=True
+    )
+    subprocess.check_call(f"sha512sum {src_tar} >{src_tar}.sha512", shell=True)
+    verify(v)
+
+
+def verify(v):
+    src_tar = f"apache-fury-incubating-{v}-src.tar.gz"
+    subprocess.check_call(f"gpg --verify {src_tar}.asc {src_tar}", shell=True)
+    logger.info("Verified signature")
+    subprocess.check_call(f"sha512sum --check {src_tar}.sha512", shell=True)
+    logger.info("Verified checksum successfully")
+
+
 def bump_version(**kwargs):
     new_version = kwargs["version"]
     langs = kwargs["l"]
@@ -157,9 +200,24 @@ def _parse_args():
     bump_version_parser.add_argument("-l", type=str, help="language")
     bump_version_parser.set_defaults(func=bump_version)
 
+    release_parser = subparsers.add_parser(
+        "build",
+        description="Build release artifacts",
+    )
+    release_parser.add_argument("-v", type=str, help="new version")
+    release_parser.set_defaults(func=build)
+
+    verify_parser = subparsers.add_parser(
+        "verify",
+        description="Verify release artifacts",
+    )
+    verify_parser.add_argument("-v", type=str, help="new version")
+    verify_parser.set_defaults(func=verify)
+
     args = parser.parse_args()
     arg_dict = dict(vars(args))
     del arg_dict["func"]
+    print(arg_dict)
     args.func(**arg_dict)
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to