From d036ebc15cc9ad7bfe33d0a888b3e131a5d87f90 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 16 Dec 2024 16:40:58 +0800 Subject: [PATCH] Add cargo publish script (#242) --- Cargo.toml | 1 + crates/workbook/Cargo.toml | 2 +- scripts/cargo-publish.sh | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 scripts/cargo-publish.sh diff --git a/Cargo.toml b/Cargo.toml index 3da2e808..6e47b83f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,7 @@ logisheets_base = { path = "crates/controller/base", version = "0.7.0" } logisheets_controller = { path = "crates/controller", version = "0.7.0" } logisheets_workbook_derives = { path = "crates/workbook/derives", version = "0.7.0" } +xmldiff = { path = "crates/xmldiff", version = "0.7.0" } logisheets_workbook = { path = "crates/workbook", version = "0.7.0" } [dependencies] diff --git a/crates/workbook/Cargo.toml b/crates/workbook/Cargo.toml index 7f240841..ad350c4e 100644 --- a/crates/workbook/Cargo.toml +++ b/crates/workbook/Cargo.toml @@ -20,7 +20,7 @@ xmlserde_derives = { workspace = true } logisheets_workbook_derives = { workspace = true } [dev-dependencies] -xmldiff = { version = "*", path = "../xmldiff" } +xmldiff = { workspace = true } [features] gents = ["dep:gents", "dep:gents_derives"] diff --git a/scripts/cargo-publish.sh b/scripts/cargo-publish.sh new file mode 100755 index 00000000..80dbf387 --- /dev/null +++ b/scripts/cargo-publish.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +SCRIPT_DIR=$(dirname "$0") + +cd $SCRIPT_DIR +cd .. + +MANIFEST_PATHS=( + "crates/xmldiff/Cargo.toml" + "crates/workbook/derives/Cargo.toml" + "crates/workbook/Cargo.toml" + "crates/controller/base/Cargo.toml" + "crates/controller/lexer/Cargo.toml" + "crates/controller/parser/Cargo.toml" + "crates/controller/ast_checker/Cargo.toml" + "crates/controller/Cargo.toml" + "Cargo.toml" +) + +for MANIFEST_PATH in "${MANIFEST_PATHS[@]}"; do + echo "Publishing package at: $MANIFEST_PATH" + + cargo publish --manifest-path "$MANIFEST_PATH" + + sleep 10 + + if [ $? -eq 0 ]; then + echo "Successfully published: $MANIFEST_PATH" + else + echo "Failed to publish: $MANIFEST_PATH" + fi +done