From 2ac01f992a422efd02a90bc8747fc0d9f1062bf3 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Fri, 30 Oct 2026 16:19:10 +0100 Subject: [PATCH] build: adopt the snap version from Cargo.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The version: key in snapcraft.yaml was a second number to bump by hand, and between releases it read whatever it was left at. The ecrou part now sets its version from [workspace.package] at pull time — the same value clap reports with --version — so Cargo.toml is the only place a version lives, and the release workflow stamps only that. A missed match fails the pack loudly. --- .github/workflows/release.yml | 4 ++-- snap/snapcraft.yaml | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73f0088..af14e9d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,8 +51,8 @@ jobs: run: | v="${GITHUB_REF_NAME#v}" sed -i "s/^version = \".*\"/version = \"$v\"/" Cargo.toml - sed -i "s/^version: \".*\"/version: \"$v\"/" snap/snapcraft.yaml - grep -H '^version' Cargo.toml snap/snapcraft.yaml + # The snap adopts this version from Cargo.toml at pull time. + grep -H '^version' Cargo.toml - uses: snapcore/action-build@v1 id: build diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f0e0e06..3557be4 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,9 @@ name: ecrou base: core26 -version: "0.1.0" +# The version is adopted from the workspace Cargo.toml at pull time — +# the same value the binary reports with --version. One number, one +# place to bump. +adopt-info: ecrou title: ecrou summary: The strictly confined microVM runtime description: | @@ -60,6 +63,13 @@ parts: rust-channel: "1.98.1" rust-path: [crates/ecrou-cli] build-packages: [cmake, perl] + override-pull: | + craftctl default + # [workspace.package] version — the single `version = "..."` at + # the head of the workspace manifest. A missed match fails the + # pack loudly instead of packing a versionless snap. + craftctl set version="$(sed -n 's/^version = "\(.*\)"/\1/p' \ + "$CRAFT_PART_SRC/Cargo.toml")" override-build: | craftctl default # The home interface stops at dotfiles, so ~/.cache is