@@ -72,18 +72,18 @@ jobs:
7272 BASE_VERSION="${CARGO_VERSION%-rc.*}"
7373 echo "Base version (for Cargo.toml comparison): $BASE_VERSION"
7474
75- # Read version from Cargo.toml and validate it matches
76- CARGO_TOML_VERSION=$(grep '^ version = ' bindings/python/Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/ ')
77- echo "Version in bindings/python/Cargo.toml : $CARGO_TOML_VERSION"
75+ # Read workspace version via cargo metadata
76+ CARGO_TOML_VERSION=$(cargo metadata --format- version 1 --no-deps -q | jq -r '.packages[0].version ')
77+ echo "Workspace version : $CARGO_TOML_VERSION"
7878
7979 if [ "$BASE_VERSION" != "$CARGO_TOML_VERSION" ]; then
8080 echo "❌ Version mismatch!"
8181 echo " Release tag base version: $BASE_VERSION"
82- echo " bindings/python/ Cargo.toml version: $CARGO_TOML_VERSION"
82+ echo " Cargo.toml (workspace) version: $CARGO_TOML_VERSION"
8383 echo "Please ensure the release tag matches the version in Cargo.toml"
8484 exit 1
8585 fi
86- echo "✅ Version matches bindings/python/ Cargo.toml"
86+ echo "✅ Version matches workspace Cargo.toml"
8787 fi
8888
8989 # Check if this is a release candidate
@@ -107,22 +107,20 @@ jobs:
107107 with :
108108 persist-credentials : false
109109
110- - name : Install toml-cli
110+ - name : Compute RC version
111111 if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
112- run : cargo install toml-cli
113-
114- - name : Set cargo version for RC
115- if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
116- working-directory : " bindings/python"
117- run : |
118- echo "Setting cargo version to: ${NEEDS_VALIDATE_RELEASE_TAG_OUTPUTS_CARGO_VERSION}"
119- toml set Cargo.toml package.version "${NEEDS_VALIDATE_RELEASE_TAG_OUTPUTS_CARGO_VERSION}" > Cargo.toml.tmp
120- # doing this explicitly to avoid issue in Windows where `mv` does not overwrite existing file
121- rm Cargo.toml
122- mv Cargo.toml.tmp Cargo.toml
112+ id : version
123113 shell : bash
124114 env :
125- NEEDS_VALIDATE_RELEASE_TAG_OUTPUTS_CARGO_VERSION : ${{ needs.validate-release-tag.outputs.cargo-version }}
115+ CARGO_VERSION : ${{ needs.validate-release-tag.outputs.cargo-version }}
116+ run : |
117+ # Convert semver RC (0.9.0-rc.1) to PEP 440 (0.9.0rc1)
118+ echo "pep440=$(echo "$CARGO_VERSION" | sed 's/-rc\.\([0-9]*\)/rc\1/')" >> $GITHUB_OUTPUT
119+
120+ - uses : ./.github/actions/overwrite-package-version
121+ if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
122+ with :
123+ version : ${{ steps.version.outputs.pep440 }}
126124
127125 - uses : PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
128126 with :
@@ -156,22 +154,20 @@ jobs:
156154 with :
157155 persist-credentials : false
158156
159- - name : Install toml-cli
160- if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
161- run : cargo install toml-cli
162-
163- - name : Set cargo version for RC
157+ - name : Compute RC version
164158 if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
165- working-directory : " bindings/python "
159+ id : version
166160 shell : bash
167161 env :
168162 CARGO_VERSION : ${{ needs.validate-release-tag.outputs.cargo-version }}
169163 run : |
170- echo "Setting cargo version to: $CARGO_VERSION"
171- toml set Cargo.toml package.version "$CARGO_VERSION" > Cargo.toml.tmp
172- # doing this explicitly to avoid issue in Windows where `mv` does not overwrite existing file
173- rm Cargo.toml
174- mv Cargo.toml.tmp Cargo.toml
164+ # Convert semver RC (0.9.0-rc.1) to PEP 440 (0.9.0rc1)
165+ echo "pep440=$(echo "$CARGO_VERSION" | sed 's/-rc\.\([0-9]*\)/rc\1/')" >> $GITHUB_OUTPUT
166+
167+ - uses : ./.github/actions/overwrite-package-version
168+ if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
169+ with :
170+ version : ${{ steps.version.outputs.pep440 }}
175171
176172 - uses : actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
177173 with :
@@ -190,7 +186,7 @@ jobs:
190186 manylinux : ${{ matrix.manylinux || 'auto' }}
191187 working-directory : " bindings/python"
192188 command : build
193- args : --release -o dist -i python3.12 # Explicitly set interpreter; manylinux containers have multiple Pythons and maturin may pick an older one
189+ args : --profile py- release -o dist -i python3.12 # Explicitly set interpreter; manylinux containers have multiple Pythons and maturin may pick an older one
194190 - uses : astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
195191 with :
196192 version : " 0.9.3"
0 commit comments