Skip to content

Commit e69c2f0

Browse files
committed
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 <[email protected]>
1 parent cc937c0 commit e69c2f0

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/libnvme-release-python.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ jobs:
5757
run: |
5858
git config --global --add safe.directory "$GITHUB_WORKSPACE"
5959
60+
- name: Configure git identity for CI
61+
run: |
62+
git config --global user.name "github-actions[bot]"
63+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
64+
6065
- name: Compute dev version from git
6166
id: version
6267
run: |
@@ -67,11 +72,18 @@ jobs:
6772
echo "dev_version=$VERSION" >> $GITHUB_OUTPUT
6873
echo "Computed dev version: $VERSION"
6974
70-
- name: Build sdist
75+
- name: Patch project version in meson.build
7176
env:
72-
MESONPY_PROJECT_VERSION: ${{ steps.version.outputs.dev_version }}
77+
DEV_VERSION: ${{ steps.version.outputs.dev_version }}
7378
run: |
74-
pipx run build --sdist
79+
sed -i -e "/^project(/,/)/ s/^\(\s*\)version:\s*.*/\1version: '${DEV_VERSION}',/" meson.build
80+
81+
- name: Commit CI version bump
82+
env:
83+
DEV_VERSION: ${{ steps.version.outputs.dev_version }}
84+
run: |
85+
git add meson.build
86+
git commit -m "ci: set project version to ${DEV_VERSION}"
7587
7688
- name: Validate sdist
7789
run: |

0 commit comments

Comments
 (0)