Skip to content

Commit

Permalink
actually add script
Browse files Browse the repository at this point in the history
  • Loading branch information
MarquessV committed Mar 13, 2024
1 parent 07c7bfc commit 0261322
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/release-python-grpc-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: '3.20.1'
- name: Patch package metadata for grpc-web
working-directory: ./crates/python
run: |
pip install toml
python crates/python/scripts/patch_package_name.py
Expand Down Expand Up @@ -95,6 +96,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: '3.20.1'
- name: Patch package metadata for grpc-web
working-directory: ./crates/python
run: |
pip install toml
python crates/python/scripts/patch_package_name.py
Expand Down Expand Up @@ -131,6 +133,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: '3.20.1'
- name: Patch package metadata for grpc-web
working-directory: ./crates/python
run: |
pip install toml
python crates/python/scripts/patch_package_name.py
Expand Down Expand Up @@ -161,6 +164,7 @@ jobs:
steps:
- uses: actions/download-artifact@v3
- name: Patch package metadata for grpc-web
working-directory: ./crates/python
run: |
pip install toml
python crates/python/scripts/patch_package_name.py
Expand Down
21 changes: 21 additions & 0 deletions crates/python/scripts/patch_package_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
Appends grpc-web to the project name of both Cargo.toml and pyproject.toml.
This is used in CI to update the package metadata before publishing the alternate
package with the grpc-web feature enabled.
"""
import toml

with open("pyproject.toml", "r+") as f:
data = toml.load(f)
data["project"]["name"] = "qcs-sdk-python-grpc-web"
f.seek(0)
f.write(toml.dumps(data))
f.truncate()

with open("Cargo.toml", "r+") as f:
data = toml.load(f)
data["package"]["name"] = "qcs-sdk-python-grpc-web"
f.seek(0)
f.write(toml.dumps(data))
f.truncate()

0 comments on commit 0261322

Please sign in to comment.