diff --git a/ostd/Cargo.toml b/ostd/Cargo.toml index 29430e913..a7a5cbbdc 100644 --- a/ostd/Cargo.toml +++ b/ostd/Cargo.toml @@ -33,8 +33,8 @@ log = "0.4" num = { version = "0.4", default-features = false } num-derive = { version = "0.4", default-features = false } num-traits = { version = "0.2", default-features = false } -ostd-macros = { version = "0.9.2", path = "libs/ostd-macros" } -ostd-test = { version = "0.9.2", path = "libs/ostd-test" } +ostd-macros = { path = "libs/ostd-macros", version = "0.9.2" } +ostd-test = { path = "libs/ostd-test", version = "0.9.2" } owo-colors = { version = "3", optional = true } ostd-pod = { git = "https://github.com/asterinas/ostd-pod", rev = "c4644be", version = "0.1.1" } spin = "0.9.4" diff --git a/tools/github_workflows/publish_osdk_and_ostd.sh b/tools/github_workflows/publish_osdk_and_ostd.sh index ef121080d..d256b91a0 100755 --- a/tools/github_workflows/publish_osdk_and_ostd.sh +++ b/tools/github_workflows/publish_osdk_and_ostd.sh @@ -51,7 +51,19 @@ do_publish_for() { TARGET_ARGS="--target $2" fi 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 else cargo publish --token $TOKEN $TARGET_ARGS