From bab919bb24f06453fff6335401ec1e6174c84d49 Mon Sep 17 00:00:00 2001 From: Stephan Boyer Date: Sun, 4 Oct 2026 06:24:12 -0700 Subject: [PATCH] Parse the version from `cargo pkgid` with parameter expansion The version was parsed in the CI workflow and Toastfile in different ways. The CI workflow's `cut` commands expected Cargo's old `name:version` format and returned `name@version` with current Cargo when the directory name differs from the package name, and the Toastfile's `grep` truncated prerelease versions. Now each takes everything after the last `#`, `@`, or `:` in the package ID, which is the version in every format. --- .github/workflows/ci.yml | 3 ++- toast.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c6979fe..0963ec1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -225,7 +225,8 @@ jobs: rustup default 1.99.0 # [group:rust_1.99.0] # Fetch the program version. - VERSION="$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" + PKGID="$(cargo pkgid)" + VERSION="${PKGID##*[#@:]}" # If the release already exists, exit early. if gh release view "v$VERSION" &> /dev/null; then diff --git a/toast.yml b/toast.yml index 792b0e9e..0077ad70 100644 --- a/toast.yml +++ b/toast.yml @@ -443,7 +443,8 @@ tasks: - src command: | # Fetch the program version. - VERSION="$(cargo-offline pkgid | grep --extended-regexp --only-matching '[0-9.]+$')" + PKGID="$(cargo-offline pkgid)" + VERSION="${PKGID##*[#@:]}" # If this version of the package already exists on crates.io, there's nothing more to do. if cargo-online search typical | grep "typical = \"$VERSION\"" > /dev/null; then