mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-21 00:06:34 +00:00
Resolve cargo publish --dry-run check failure
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
3f1fa33b13
commit
b269118c9a
@ -33,8 +33,8 @@ log = "0.4"
|
|||||||
num = { version = "0.4", default-features = false }
|
num = { version = "0.4", default-features = false }
|
||||||
num-derive = { version = "0.4", default-features = false }
|
num-derive = { version = "0.4", default-features = false }
|
||||||
num-traits = { version = "0.2", default-features = false }
|
num-traits = { version = "0.2", default-features = false }
|
||||||
ostd-macros = { version = "0.9.2", path = "libs/ostd-macros" }
|
ostd-macros = { path = "libs/ostd-macros", version = "0.9.2" }
|
||||||
ostd-test = { version = "0.9.2", path = "libs/ostd-test" }
|
ostd-test = { path = "libs/ostd-test", version = "0.9.2" }
|
||||||
owo-colors = { version = "3", optional = true }
|
owo-colors = { version = "3", optional = true }
|
||||||
ostd-pod = { git = "https://github.com/asterinas/ostd-pod", rev = "c4644be", version = "0.1.1" }
|
ostd-pod = { git = "https://github.com/asterinas/ostd-pod", rev = "c4644be", version = "0.1.1" }
|
||||||
spin = "0.9.4"
|
spin = "0.9.4"
|
||||||
|
@ -51,7 +51,19 @@ do_publish_for() {
|
|||||||
TARGET_ARGS="--target $2"
|
TARGET_ARGS="--target $2"
|
||||||
fi
|
fi
|
||||||
if [ -n "$DRY_RUN" ]; then
|
if [ -n "$DRY_RUN" ]; then
|
||||||
cargo publish --dry-run $TARGET_ARGS
|
# Temporarily change the crate version to the next patched version.
|
||||||
|
#
|
||||||
|
# `cargo publish --dry-run` requires that
|
||||||
|
# the crate version is not already published on crates.io,
|
||||||
|
# otherwise, the check will fail.
|
||||||
|
# Therefore, we modify the crate version to ensure it is not published.
|
||||||
|
current_version=$(cat $ASTER_SRC_DIR/VERSION)
|
||||||
|
next_patched_version=$(echo "$current_version" | awk -F. '{printf "%d.%d.%d\n", $1, $2, $3 + 1}')
|
||||||
|
pattern="^version = \"[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\"$"
|
||||||
|
sed -i "0,/${pattern}/s/${pattern}/version = \"${next_patched_version}\"/1" Cargo.toml
|
||||||
|
|
||||||
|
# Perform checks
|
||||||
|
cargo publish --dry-run --allow-dirty $TARGET_ARGS
|
||||||
cargo doc $TARGET_ARGS
|
cargo doc $TARGET_ARGS
|
||||||
else
|
else
|
||||||
cargo publish --token $TOKEN $TARGET_ARGS
|
cargo publish --token $TOKEN $TARGET_ARGS
|
||||||
|
Reference in New Issue
Block a user