-
Notifications
You must be signed in to change notification settings - Fork 616
chore: automate Rust crate versioning in publish-ci #7373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
8c5151c
6de03a9
37987c3
33c08c1
e7308b0
ab07550
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,117 @@ | ||||||
| #!/usr/bin/env node | ||||||
| /** | ||||||
| * Bumps the Rust crate version based on conventional commits since the last | ||||||
| * Beachball-generated release tag, then packages the crate into publish_artifacts_cargo/. | ||||||
| * | ||||||
| * Beachball tags use the format: {package-name}_v{version} | ||||||
| * e.g. microsoft-fast-build_v0.1.0 | ||||||
| * | ||||||
| * Version bump rules (conventional commits): | ||||||
| * BREAKING CHANGE / feat!: / fix!: → major | ||||||
| * feat: → minor | ||||||
| * anything else → patch | ||||||
| * | ||||||
|
Comment on lines
+9
to
+13
|
||||||
| * Only commits that touch crates/microsoft-fast-build/ are considered. | ||||||
| * If no such commits exist since the last Beachball tag, the script exits without change. | ||||||
| */ | ||||||
| import { execSync } from "node:child_process"; | ||||||
| import { readFileSync, writeFileSync, mkdirSync, copyFileSync, globSync } from "node:fs"; | ||||||
| import { join, dirname } from "node:path"; | ||||||
| import { fileURLToPath } from "node:url"; | ||||||
|
|
||||||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||||||
| const repoRoot = join(__dirname, ".."); | ||||||
| const crateDir = join(repoRoot, "crates", "microsoft-fast-build"); | ||||||
| const cargoTomlPath = join(crateDir, "Cargo.toml"); | ||||||
| const outputDir = join(repoRoot, "publish_artifacts_cargo"); | ||||||
|
||||||
| const outputDir = join(repoRoot, "publish_artifacts_cargo"); | |
| const outputDir = join(repoRoot, "publish_artifacts", "cargo"); |
Outdated
Copilot
AI
Apr 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script tries to find the last release tag by constructing ${crateName}_v${currentVersion} from Cargo.toml. If Cargo.toml’s version ever diverges from the most recent tag (e.g., the npm package tag is newer), rev-parse will fail and the script will fall back to scanning all history, causing incorrect bumps. Instead, resolve the latest existing tag matching the crate (e.g., via git describe --tags --match "${crateName}_v*" --abbrev=0 or git tag --list ... --sort=-version:refname | head -n1).
Copilot
AI
Apr 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The header comment’s major-bump rules say BREAKING CHANGE / feat!: / fix!: cause a major, but determineBump also treats refactor! and chore! as major. Update the doc comment to match the implemented behavior (or narrow the regex) so future maintainers don’t misinterpret the bump logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions tags like
microsoft-fast-build-vX.Y.Z, but this script/documentation uses{package-name}_v{version}(underscore) and examples likemicrosoft-fast-build_v0.1.0. Please align the implementation/docs with the actual tag format being produced/consumed to avoid silently never finding the intended tag.