There are 3 crates: mediasoup, mediasoup-sys and mediasoup-types:
mediasoup-syscrate wraps C++ worker into Rust.mediasoup-typescrate defines and exposes mediasoup Rust types.mediasoupcrate usesmediasoup-sysandmediasoup-typesand it exposes nice user API in idiomatic Rust.mediasoup-sysis the only one that needs updating if changes are purely inside the worker or inside themediasoup-syscrate. You can bump them all, but it is not required.- If
mediasoup-sys's API changes in a breaking way, then its minor version needs to be changed, otherwise patch version needs to be changed. Same formediasoup-typescrate.
Important: Adding new APIs that mediasoup crate has to understand to continue working normally is a breaking change because it'll start crashing/printing errors if unexpected things happen.
Each crate is published through an automated flow (mirroring how the NPM package is released): npm run release:rust <crate> X.Y.Z bumps the version, commits and pushes, and the mediasoup-crate-publish.yaml workflow then publishes the crate to crates.io via OIDC trusted publishing.
Because mediasoup depends on mediasoup-sys and mediasoup-types, when more than one crate needs a new version, publish the dependencies first (mediasoup-types and/or mediasoup-sys) and mediasoup last, so each crate's dependencies are already on crates.io when it is published. You don't need to wait for the dependencies' workflow runs to finish before releasing mediasoup. The publish workflow runs are serialized, so its own run stays queued until they are done. Each release updates only the released crate's own resolved version in Cargo.lock (within that crate's release commit), so releasing a dependency is what refreshes its Cargo.lock entry, and the later mediasoup release only touches mediasoup's own entry.
You do not bump the crate's [package].version, edit rust/CHANGELOG.md, nor edit the sibling version requirements in rust/Cargo.toml yourself; npm run release:rust does all that. For each crate to publish:
- Have the crate's code changes merged on the main branch. When publishing the
mediasoupcrate, the changes for the new version must be under the### NEXTheading ofrust/CHANGELOG.md. - You do not edit the
versionof[dependencies.mediasoup-sys]/[dependencies.mediasoup-types]inrust/Cargo.tomlyourself: that requirement is what the publishedmediasoupcrate depends on (itspathis only used for local builds and is dropped when published). Releasingmediasoup-sys/mediasoup-typesautomatically bumps that requirement to the just-released version and commits it together with the release, so themediasoupcrate always depends on the latest version of its siblings (and the workspace stays buildable after a breaking minor/major bump, where the requirement must keep accepting the sibling's actual version). - Make sure
Cargo.lockis already in sync with the merged code, committing it if an earlier change to third-party dependencies left it stale (runcargo build). This is only about pre-existing code changes, not the version bump:npm run release:rustregeneratesCargo.lockfor the bumped version itself and commits it within the crate's own release commit. A staleCargo.lockis harmless for crate consumers (they ignore the packaged lock) but leaves the repo out of sync and breaks the--lockedGitHub Actions workflows, and the release aborts on it. - On the main branch, with a clean work tree, run:
npm run release:rust mediasoup-types X.Y.Z
# and/or
npm run release:rust mediasoup-sys X.Y.Z
# and finally release a new version of the main mediasoup crate (no need to wait
# for the GitHub Actions runs above to complete):
npm run release:rust mediasoup X.Y.ZThis runs the checks, bumps the crate version in its Cargo.toml (and, for mediasoup-sys / mediasoup-types, the matching version requirement in the mediasoup crate's rust/Cargo.toml) and in Cargo.lock, and then:
- For
mediasoup: sets the top### NEXTheading ofrust/CHANGELOG.mdto### X.Y.Z, commits (release rust-X.Y.Z [no-ci]), creates therust-X.Y.Ztag and pushes the branch and the tag. The tag triggersmediasoup-crate-publish.yaml, which creates the GitHub release fromrust/CHANGELOG.mdand publishes the crate. - For
mediasoup-sys/mediasoup-types: commits (<crate> X.Y.Z [crate-publish] [no-ci]) and pushes the branch (no tag, no GitHub release). The[crate-publish]marker is whatmediasoup-crate-publish.yamldetects on the branch push to publish that crate.
See npm run release:rust in Building.md for more details.