From ea2ab649f2a575e8ff910157374103b50727b218 Mon Sep 17 00:00:00 2001 From: Stephan Boyer Date: Sun, 4 Oct 2026 06:24:08 -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 68c4371..3cf8fa0 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##*[#@:]}" # Determine if the release already exists. if gh release view "v$VERSION" &> /dev/null; then diff --git a/toast.yml b/toast.yml index f6cf672..1bf6704 100644 --- a/toast.yml +++ b/toast.yml @@ -303,7 +303,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 docuum | grep "docuum = \"$VERSION\"" > /dev/null; then