Skip to content

Commit 2715d52

Browse files
authored
CI: Fix Nightly PyPi GitHub Action (#1689)
1 parent 034340f commit 2715d52

File tree

1 file changed

+12
-3
lines changed
  • .github/actions/overwrite-package-version

1 file changed

+12
-3
lines changed

.github/actions/overwrite-package-version/action.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,24 @@ runs:
3838
env:
3939
TIMESTAMP: ${{ inputs.timestamp }}
4040
run: |
41+
# Read the current version from the Rust crate's Cargo.toml
4142
CURRENT_VERSION=$(python -c "import toml; print(toml.load('bindings/python/Cargo.toml')['package']['version'])")
4243
export NEW_VERSION="${CURRENT_VERSION}.dev${TIMESTAMP}"
44+
echo "Current version: ${CURRENT_VERSION}"
45+
echo "New dev version: ${NEW_VERSION}"
46+
47+
# Update bindings/python/pyproject.toml:
48+
# - Set project.version = NEW_VERSION
49+
# - Ensure 'version' is not listed in project.dynamic
4350
python -c "
4451
import toml
4552
import os
46-
config = toml.load('bindings/python/Cargo.toml')
53+
config = toml.load('bindings/python/pyproject.toml')
4754
new_version = os.environ['NEW_VERSION']
48-
config['package']['version'] = new_version
49-
with open('bindings/python/Cargo.toml', 'w') as f:
55+
config['project']['version'] = new_version
56+
if 'dynamic' in config['project']:
57+
config['project']['dynamic'] = [v for v in config['project']['dynamic'] if v != 'version']
58+
with open('bindings/python/pyproject.toml', 'w') as f:
5059
toml.dump(config, f)
5160
print(f'Updated version to: {new_version}')
5261
"

0 commit comments

Comments
 (0)