From ebb676c8599ac2b293594b6e5c4aee9c68f6684c Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Mon, 12 Jan 2026 11:23:43 +0100 Subject: [PATCH] build: commit CI-generated version so sdist gets correct metadata The sdist must contain a unique, correctly set version string. Overriding the version via MESONPY_PROJECT_VERSION does not work when building from a Git checkout, and modifying meson.build alone is insufficient because uncommitted changes are not included in the source archive. Create a temporary, local commit in CI so the generated tarball carries the correct version metadata. Signed-off-by: Daniel Wagner --- .github/workflows/libnvme-release-python.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/libnvme-release-python.yml b/.github/workflows/libnvme-release-python.yml index fce4c01c99..8bfa88a8d0 100644 --- a/.github/workflows/libnvme-release-python.yml +++ b/.github/workflows/libnvme-release-python.yml @@ -57,6 +57,11 @@ jobs: run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Configure git identity for CI + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + - name: Compute dev version from git id: version run: | @@ -67,11 +72,18 @@ jobs: echo "dev_version=$VERSION" >> $GITHUB_OUTPUT echo "Computed dev version: $VERSION" - - name: Build sdist + - name: Patch project version in meson.build env: - MESONPY_PROJECT_VERSION: ${{ steps.version.outputs.dev_version }} + DEV_VERSION: ${{ steps.version.outputs.dev_version }} run: | - pipx run build --sdist + sed -i -e "/^project(/,/)/ s/^\(\s*\)version:\s*.*/\1version: '${DEV_VERSION}',/" meson.build + + - name: Commit CI version bump + env: + DEV_VERSION: ${{ steps.version.outputs.dev_version }} + run: | + git add meson.build + git commit -m "ci: set project version to ${DEV_VERSION}" - name: Validate sdist run: |