v2.6.0 (#524)
Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai> Co-authored-by: Gauthier Guinet <43207538+Gguinet@users.noreply.github.com> Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai> Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com> Co-authored-by: Quentin <torroba.q@gmail.com> Co-authored-by: Simon <80467011+sorgfresser@users.noreply.github.com> Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@mistral.ai> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: angelapopopo <angele.lenglemetz@mistral.ai> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
5103019b01
commit
eb580209d4
180 changed files with 11136 additions and 1030 deletions
|
|
@ -130,7 +130,9 @@ def create_release_branch(version: str) -> None:
|
|||
print(f"Created and switched to branch {branch_name}")
|
||||
|
||||
|
||||
def cherry_pick_commits(previous_version: str, current_version: str) -> None:
|
||||
def cherry_pick_commits(
|
||||
previous_version: str, current_version: str, squash: bool
|
||||
) -> None:
|
||||
previous_tag = f"v{previous_version}-private"
|
||||
current_tag = f"v{current_version}-private"
|
||||
|
||||
|
|
@ -150,6 +152,53 @@ def cherry_pick_commits(previous_version: str, current_version: str) -> None:
|
|||
run_git_command("cherry-pick", f"{previous_tag}..{current_tag}")
|
||||
print("Successfully cherry-picked all commits")
|
||||
|
||||
if squash:
|
||||
squash_commits(previous_version, current_version, previous_tag, current_tag)
|
||||
|
||||
|
||||
def squash_commits(
|
||||
previous_version: str, current_version: str, previous_tag: str, current_tag: str
|
||||
) -> None:
|
||||
print("Squashing commits into a single release commit...")
|
||||
run_git_command("reset", "--soft", f"v{previous_version}")
|
||||
|
||||
# Get all contributors between previous and current private tags
|
||||
result = run_git_command(
|
||||
"log",
|
||||
f"{previous_tag}..{current_tag}",
|
||||
"--format=%aN <%aE>",
|
||||
capture_output=True,
|
||||
)
|
||||
contributors = result.stdout.strip().split("\n")
|
||||
|
||||
# Get current user
|
||||
current_user_result = run_git_command("config", "user.email", capture_output=True)
|
||||
current_user_email = current_user_result.stdout.strip()
|
||||
|
||||
# Filter out current user and create co-authored lines
|
||||
vibe_marker = "vibe@mistral.ai"
|
||||
unique_coauthors = {
|
||||
f"Co-authored-by: {contributor}"
|
||||
for contributor in contributors
|
||||
if contributor
|
||||
and current_user_email not in contributor
|
||||
and vibe_marker not in contributor
|
||||
}
|
||||
|
||||
# Add Mistral Vibe as co-author
|
||||
coauthored_lines = sorted(unique_coauthors) + [
|
||||
"Co-authored-by: Mistral Vibe <vibe@mistral.ai>"
|
||||
]
|
||||
|
||||
# Create commit message
|
||||
commit_message = f"v{current_version}\n"
|
||||
for line in coauthored_lines:
|
||||
commit_message += f"\n{line}"
|
||||
|
||||
# Create the commit
|
||||
run_git_command("commit", "-m", commit_message)
|
||||
print("Successfully created release commit with co-authors")
|
||||
|
||||
|
||||
def get_commits_summary(previous_version: str, current_version: str) -> str:
|
||||
previous_tag = f"v{previous_version}-private"
|
||||
|
|
@ -182,6 +231,7 @@ def print_summary(
|
|||
previous_version: str,
|
||||
commits_summary: str,
|
||||
changelog_entry: str,
|
||||
squash: bool,
|
||||
) -> None:
|
||||
print("\n" + "=" * 80)
|
||||
print("RELEASE PREPARATION SUMMARY")
|
||||
|
|
@ -204,14 +254,15 @@ def print_summary(
|
|||
print(changelog_entry)
|
||||
|
||||
print("\n" + "-" * 80)
|
||||
print("NEXT STEPS")
|
||||
print("-" * 80)
|
||||
print(
|
||||
f"To review/edit commits before publishing, use interactive rebase:\n"
|
||||
f" git rebase -i v{previous_version}"
|
||||
)
|
||||
if not squash:
|
||||
print("NEXT STEPS")
|
||||
print("-" * 80)
|
||||
print(
|
||||
f"To review/edit commits before publishing, use interactive rebase:\n"
|
||||
f" git rebase -i v{previous_version}"
|
||||
)
|
||||
|
||||
print("\n" + "-" * 80)
|
||||
print("\n" + "-" * 80)
|
||||
print("REMINDERS")
|
||||
print("-" * 80)
|
||||
print("Before publishing the release:")
|
||||
|
|
@ -231,9 +282,17 @@ def main() -> None:
|
|||
)
|
||||
|
||||
parser.add_argument("version", help="Version to prepare release for (e.g., 1.1.3)")
|
||||
parser.add_argument(
|
||||
"--no-squash",
|
||||
action="store_false",
|
||||
dest="squash",
|
||||
default=True,
|
||||
help="Disable squashing of commits into a single release commit",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
current_version = args.version
|
||||
squash = args.squash
|
||||
|
||||
try:
|
||||
# Step 1: Ensure public remote exists
|
||||
|
|
@ -264,7 +323,7 @@ def main() -> None:
|
|||
create_release_branch(current_version)
|
||||
|
||||
# Step 7: Cherry-pick commits
|
||||
cherry_pick_commits(previous_version, current_version)
|
||||
cherry_pick_commits(previous_version, current_version, squash)
|
||||
|
||||
# Step 8: Get summary information
|
||||
commits_summary = get_commits_summary(previous_version, current_version)
|
||||
|
|
@ -272,7 +331,7 @@ def main() -> None:
|
|||
|
||||
# Step 9: Print summary
|
||||
print_summary(
|
||||
current_version, previous_version, commits_summary, changelog_entry
|
||||
current_version, previous_version, commits_summary, changelog_entry, squash
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue