Bump only package version in Cargo.toml

This commit is contained in:
Jianfeng Jiang 2024-05-23 06:34:39 +00:00 committed by Tate, Hongliang Tian
parent 2ecca7af6b
commit 6c34db52b3
2 changed files with 17 additions and 17 deletions

View File

@ -10,17 +10,12 @@ repository = "https://github.com/asterinas/asterinas"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies.linux-bzimage-builder] [dependencies.linux-bzimage-builder]
git = "https://github.com/asterinas/asterinas" # The path for local development
# Make sure it syncs with `crate::util::ASTER_GIT_REV` path = "../framework/libs/linux-bzimage/builder"
rev = "c9b66bd" # The version specified here is used for publishing on crates.io.
# When publishing, the crate.io version is used, make sure # Please update this version when publishing the cargo-osdk crate
# the builder is published # if there have been any changes to the dependent crate.
# FIXME: The version is currently commented out as it is no longer in use. version = "0.1.0"
# If this version is being used,
# please ensure to update `bump_version.sh` appropriately.
# `bump_version.sh will also update this version,
# however, the dependent crate may not share the same version as the whole project.
# version = "0.1.0"
[dependencies] [dependencies]
clap = { version = "4.4.17", features = ["cargo", "derive"] } clap = { version = "4.4.17", features = ["cargo", "derive"] }

View File

@ -2,13 +2,18 @@
# SPDX-License-Identifier: MPL-2.0 # SPDX-License-Identifier: MPL-2.0
set -e
# This script is used to update Asterinas version numbers in all relevant files in the repository. # This script is used to update Asterinas version numbers in all relevant files in the repository.
# Usage: ./tools/bump_version.sh <new_version> # Usage: ./tools/bump_version.sh <new_version>
# Update Cargo style versions (`version = "{version}"`) in file $1 # Update the package version (`version = "{version}"`) in file $1
update_cargo_versions() { update_package_version() {
echo "Updating file $1" echo "Updating file $1"
sed -i "s/^version = \"[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\"$/version = \"${new_version}\"/g" $1 # Package version is usually the first version in Cargo.toml,
# so only the first matched version is updated.
pattern="^version = \"[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\"$"
sed -i "0,/${pattern}/s/${pattern}/version = \"${new_version}\"/1" $1
} }
# Update Docker image versions (`asterinas/asterinas:{version}`) in file $1 # Update Docker image versions (`asterinas/asterinas:{version}`) in file $1
@ -31,9 +36,9 @@ else
exit -1 exit -1
fi fi
# Update Cargo.toml # Update the package version in Cargo.toml
update_cargo_versions ${CARGO_TOML_PATH} update_package_version ${CARGO_TOML_PATH}
update_cargo_versions ${OSDK_CARGO_TOML_PATH} update_package_version ${OSDK_CARGO_TOML_PATH}
# Automatically bump Cargo.lock file # Automatically bump Cargo.lock file
cargo update -p asterinas --precise $new_version cargo update -p asterinas --precise $new_version