Skip to content

Commit 9787140

Browse files
authored
infra: use toml-cli to manually set version in github action (#1537)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #. ## What changes are included in this PR? See [comment](#1331 (comment)) for context Previously used `cargo-edit` but it does not allow setting version from `0.6.0` -> `0.6.0-rc1`. This PR changes the github action to use `toml-cli` to manually override and set the version in the `binding/python/Cargo.toml` so that we can build pre-release artifacts to push to pypi. <!-- Provide a summary of the modifications in this PR. List the main changes such as new features, bug fixes, refactoring, or any other updates. --> ## Are these changes tested? <!-- Specify what test covers (unit test, integration test, etc.). If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> Yes, similar to #1449 Pushed this PR as the `main` branch in my fork Create a new tag and push to fork to trigger CI ``` git tag "v0.6.0-rc.2" -m "v0.6.0-rc.2" git push kevinjqliu v0.6.0-rc.2 ``` Verify that python artifacts are build correctly with pre-release tag, https://github.com/kevinjqliu/iceberg-rust/actions/runs/16436181005 - downloaded `wheels-sdist`, verified correct version in `PKG-INFO` but not in `Cargo.toml`. I think this is fine - downloaded `wheels-ubuntu-latest-armv7l` and verified the `METADATA` file
1 parent a33a3db commit 9787140

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

.github/workflows/release_python.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,19 @@ jobs:
8787
steps:
8888
- uses: actions/checkout@v4
8989

90-
- name: Install cargo-edit
90+
- name: Install toml-cli
9191
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
92-
run: cargo install cargo-edit
92+
run: cargo install toml-cli
9393

9494
- name: Set cargo version for RC
9595
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
9696
working-directory: "bindings/python"
9797
run: |
9898
echo "Setting cargo version to: ${{ needs.validate-release-tag.outputs.cargo-version }}"
99-
cargo set-version ${{ needs.validate-release-tag.outputs.cargo-version }}
99+
toml set Cargo.toml package.version ${{ needs.validate-release-tag.outputs.cargo-version }} > Cargo.toml.tmp
100+
# doing this explicitly to avoid issue in Windows where `mv` does not overwrite existing file
101+
rm Cargo.toml
102+
mv Cargo.toml.tmp Cargo.toml
100103
101104
- uses: PyO3/maturin-action@v1
102105
with:
@@ -127,16 +130,19 @@ jobs:
127130
steps:
128131
- uses: actions/checkout@v4
129132

130-
- name: Install cargo-edit
133+
- name: Install toml-cli
131134
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
132-
run: cargo install cargo-edit
135+
run: cargo install toml-cli
133136

134137
- name: Set cargo version for RC
135138
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
136139
working-directory: "bindings/python"
137140
run: |
138141
echo "Setting cargo version to: ${{ needs.validate-release-tag.outputs.cargo-version }}"
139-
cargo set-version ${{ needs.validate-release-tag.outputs.cargo-version }}
142+
toml set Cargo.toml package.version ${{ needs.validate-release-tag.outputs.cargo-version }} > Cargo.toml.tmp
143+
# doing this explicitly to avoid issue in Windows where `mv` does not overwrite existing file
144+
rm Cargo.toml
145+
mv Cargo.toml.tmp Cargo.toml
140146
141147
- uses: actions/setup-python@v5
142148
with:

0 commit comments

Comments
 (0)