File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,19 @@ if [[ -z "$library_path" || -z "$level" ]]; then
1212 exit 1
1313fi
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+
1524cd " $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
2230if [[ " $dry_run " != " true" ]]; then
2836
2937# CI output
3038if [[ -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 "
3441fi
You can’t perform that action at this time.
0 commit comments