Skip to content

Commit

Permalink
ci: properly extract crate version during packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardosm committed Apr 16, 2024
1 parent 28cfcb1 commit fe4ff1b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ci/package-crates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ if [ -e "$pkgs_dir" ]; then
exit 1
fi

version="$(awk '/^version = ".+"$/ { sub("^version = \"", ""); sub("\"$", ""); print }' Cargo.toml)"

echo "::group::Fetch dependencies"
cargo fetch --locked
echo "::endgroup::"
Expand All @@ -26,6 +24,16 @@ crates=(

for crate in "${crates[@]}"; do
echo "::group::Package $crate"
version="$(
cargo metadata --format-version 1 --frozen --no-deps | jq -r "
[ .packages[] | select(.name == \"$crate\") | .version ] |
if length == 1 then
first
else
error(\"expected exactly one package named $crate\")
end
"
)"
cargo package -p "$crate" --frozen
tar -xf "target/package/$crate-$version.crate" -C "$pkgs_dir"
pkg_checksum="$(sha256sum "target/package/$crate-$version.crate" | awk '{print $1}')"
Expand Down

0 comments on commit fe4ff1b

Please sign in to comment.