When performing tauri
builds, we would want to bump the version up for every build.
Please note that you can disregard using the
version
prop intauri.conf.json
file, as the build version will fallback to theCargo.toml
version value.
Thankfully, we have an awesome cargo
we could use, cargo-bump
(https://crates.io/crates/cargo-bump).
Installation
- In your
tauri
project, go tosrc-tauri
folder. - Next, install the
cargo
likecargo install cargo-bump
. - Once
cargo
installation has been completed, you can now bump the version up such ascargo bump
.
Examples of using cargo bump
Increment the patch version: cargo bump
or cargo bump patch
Increment the minor version: cargo bump minor
Set the version number directly: cargo bump 1.0.1
For updated usage examples, please see https://crates.io/crates/cargo-bump
Before Cargo.toml
[package]
name = "my-tauri-app"
version = "1.0.0"
...
After Cargo.toml
[package]
name = "my-tauri-app"
version = "1.0.1"
...
That's it!
All done, your Cargo.toml
file should have version = "1.0.0"
updated. Happy coding!
I recommend learning Rust, it is a powerful programming language, with a suite of
cargo
libraries. I've been enjoying Rust when developing Tauri applications.
Top comments (2)
As awesome as it is, I'd worried about using something that has received a last commit 5 years ago.
I agree cause what you said is true - it is a simple crate made by the author to easily update the
Cargo.toml
. I found this crate to satisfy a temporary convenience.And there are other ways to achieve this "bump version need", such as utilising bash scripting, which I did implement before learning about
cargo-bump
crate existence. But of course, the written bash script was for local use only and was not ready for CI/CD use.Bonus, I think there's a new contender in town, see crates.io/crates/cargo-edit#cargo-... and try out
set-version
command. I'll try this crate out when I am free, as reading I am unsure if it meantset-version
for a dependency installed or theversion = "1.0.1"
(example).