Skip to content

chore: automate Rust crate versioning in publish-ci#7425

Draft
janechu wants to merge 1 commit intomainfrom
users/janechu/fix-pr-for-version-bump-rust-crate
Draft

chore: automate Rust crate versioning in publish-ci#7425
janechu wants to merge 1 commit intomainfrom
users/janechu/fix-pr-for-version-bump-rust-crate

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented Apr 10, 2026

Pull Request

📖 Description

When npm run publish-ci runs, it now also handles the microsoft-fast-build Rust crate automatically via a new build/publish-rust.mjs script.

This is a revised version of #7373 that addresses all review comments.

Changes

build/publish-rust.mjs (new)

A Node.js script that:

  1. Finds the latest Beachball-generated tag matching microsoft-fast-build_v* using git tag --list --sort=-version:refname, falling back to all history if none exists
  2. Inspects git commits touching crates/microsoft-fast-build/ since that tag
  3. Determines the version bump type using conventional commits:
    • BREAKING CHANGE / feat!: / fix!: / refactor!: / chore!:major
    • feat:minor
    • anything else → patch
  4. Updates the version in crates/microsoft-fast-build/Cargo.toml
  5. Runs cargo package and copies the .crate file to publish_artifacts/cargo/
  6. Exits cleanly (no-op) if no relevant commits are found since the last release

package.json

Updated publish-ci to run the Rust script before beachball:

node build/publish-rust.mjs && beachball publish -y --no-publish

build/README.md and build/DESIGN.md (new)

Added documentation for the build utilities workspace.

Behavior

Scenario Result
Commits touch crates/microsoft-fast-build/ Version bumped, crate packaged to publish_artifacts/cargo/
No commits to crate since last tag Script exits cleanly, no changes

This mirrors the existing pattern: beachball → publish_artifacts/ (npm), new script → publish_artifacts/cargo/ (Rust).

Review comments addressed from #7373

  • Header comment mismatch: Updated doc comment to document all major bump triggers (refactor!:, chore!:)
  • Output directory: Changed from publish_artifacts_cargo/ to publish_artifacts/cargo/ (covered by existing .gitignore entry for publish_artifacts/)
  • Tag format alignment: Consistent use of {package-name}_v{version} (underscore) format throughout
  • Script ordering: Rust script runs before beachball so the Cargo.toml version bump is captured in the commit
  • Tag lookup: Uses git tag --list --sort=-version:refname instead of constructing tag from Cargo.toml version

🎫 Issues

Supersedes #7373

👩‍💻 Reviewer Notes

No .gitignore changes are needed because publish_artifacts/ is already ignored and publish_artifacts/cargo/ falls under that pattern.

The script runs before beachball in publish-ci so the Cargo.toml version bump is included in the beachball commit.

📑 Test Plan

  • All existing tests pass (10917 pass, 0 fail)
  • npm run build succeeds
  • Biome formatting/linting passes
  • No change files required (this is a build tooling change, not a package change)

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

⏭ Next Steps

Add build/publish-rust.mjs to bump the microsoft-fast-build Rust crate
version based on conventional commits since the last Beachball tag, then
package the crate into publish_artifacts/cargo/.

Address review comments from PR #7373:
- Use publish_artifacts/cargo/ (covered by existing .gitignore entry)
- Align tag format documentation to underscore convention
- Run Rust script before beachball to capture Cargo.toml bump in commit
- Use git tag --list for tag discovery instead of version construction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant