chore: Git tag while bumping crates (#9596)

This commit is contained in:
Donny/강동윤 2024-10-01 11:46:27 +09:00 committed by GitHub
parent 3d9d641f8b
commit 8d18935c6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -90,7 +90,8 @@ fn run_bump(workspace_dir: &Path, dry_run: bool) -> Result<()> {
update_changelog().with_context(|| "failed to update changelog")?;
}
commit(dry_run).context("failed to commit")?;
git_commit(dry_run).context("failed to commit")?;
git_tag_core(dry_run).context("failed to tag core")?;
Ok(())
}
@ -126,7 +127,7 @@ fn get_swc_core_version() -> Result<String> {
.context("failed to find swc_core")
}
fn commit(dry_run: bool) -> Result<()> {
fn git_commit(dry_run: bool) -> Result<()> {
let core_ver = get_swc_core_version()?;
let mut cmd = Command::new("git");
@ -146,6 +147,23 @@ fn commit(dry_run: bool) -> Result<()> {
Ok(())
}
fn git_tag_core(dry_run: bool) -> Result<()> {
let core_ver = get_swc_core_version()?;
let mut cmd = Command::new("git");
cmd.arg("tag").arg(format!("swc_core@v{}", core_ver));
eprintln!("Running {:?}", cmd);
if dry_run {
return Ok(());
}
cmd.status().context("failed to run git tag")?;
Ok(())
}
struct Bump<'a> {
/// Original versions
versions: &'a VersionMap,