Skip to content

Commit 6899898

Browse files
committed
ci: fix publish tag name
1 parent 557f464 commit 6899898

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/publish-rust.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ if [[ -z "$library_path" || -z "$level" ]]; then
1212
exit 1
1313
fi
1414

15+
ABS_MANIFEST_PATH=$(realpath $library_path/Cargo.toml)
16+
17+
# Function for obtaining manifest fields from the Cargo.toml.
18+
get_manifest_field() {
19+
local field="$1"
20+
cargo metadata --no-deps --format-version 1 \
21+
| jq --arg path "$ABS_MANIFEST_PATH" -r ".packages[] | select(.manifest_path == \$path) | .${field}"
22+
}
23+
1524
cd "$library_path"
1625

17-
# Extract crate name using cargo metadata
18-
metadata=$(cargo metadata --no-deps --format-version 1)
19-
crate_name=$(echo "$metadata" | jq -r '.packages[0].name')
26+
# Extract crate name
27+
crate_name=$(get_manifest_field "name")
2028

2129
# Run cargo-release
2230
if [[ "$dry_run" != "true" ]]; then
@@ -28,7 +36,6 @@ fi
2836

2937
# CI output
3038
if [[ -n "${CI:-}" ]]; then
31-
metadata=$(cargo metadata --no-deps --format-version 1)
32-
new_version=$(echo "$metadata" | jq -r '.packages[0].version')
39+
new_version=$(get_manifest_field "version")
3340
echo "new_version=${new_version}" >> "$GITHUB_OUTPUT"
3441
fi

0 commit comments

Comments
 (0)