diff --git a/.github/workflows/release-python-grpc-web.yml b/.github/workflows/release-python-grpc-web.yml index cd42d110f..ded5c1def 100644 --- a/.github/workflows/release-python-grpc-web.yml +++ b/.github/workflows/release-python-grpc-web.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/crates/python/scripts/patch_package_name.py b/crates/python/scripts/patch_package_name.py new file mode 100644 index 000000000..89ba88a68 --- /dev/null +++ b/crates/python/scripts/patch_package_name.py @@ -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()