From 117ccc85f3318fc17d8ce96d4d43f328c7f4a22d Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 27 Jan 2026 23:29:05 +0530 Subject: [PATCH 1/6] Use PYPI_TOKEN for PyPI uploads Add release trigger to workflow --- .github/workflows/conda-build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conda-build.yml b/.github/workflows/conda-build.yml index 98baff384..07e1d3292 100644 --- a/.github/workflows/conda-build.yml +++ b/.github/workflows/conda-build.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - master + release: + types: [published] workflow_dispatch: jobs: @@ -82,9 +84,7 @@ jobs: needs: [build] environment: name: pypi - url: https://pypi.org/p/ml-metadata/ - permissions: - id-token: write + url: https://pypi.org/p/ml-metadata-czgdp1807/ steps: - name: Retrieve wheels uses: actions/download-artifact@v4.1.8 @@ -100,3 +100,5 @@ jobs: uses: pypa/gh-action-pypi-publish@release/v1.9 with: packages_dir: wheels/ + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} From 363f94e544e365dfd3f26a77344f0ff45dd77102 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 28 Jan 2026 12:33:45 +0530 Subject: [PATCH 2/6] Document PyPI release workflows: workflow_dispatch and GitHub release Add comprehensive release documentation with shared setup steps and two release methods: manual workflow_dispatch and automated GitHub release with tags. --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/README.md b/README.md index b2586734c..bb98961cd 100644 --- a/README.md +++ b/README.md @@ -125,3 +125,69 @@ MLMD is built and tested on the following 64-bit operating systems: * Ubuntu 20.04 or later. * [DEPRECATED] Windows 10 or later. For a Windows-compatible library, please refer to MLMD 1.14.0 or earlier versions. + +## Releasing Wheels to PyPI + +### Setup (Required for both release methods) + +Before releasing, you need to set up the PyPI environment and token once: + +**Step 1: Create PyPI environment** + +Create a new environment named `pypi` in the GitHub repository: +- Go to https://github.com/google/ml-metadata/settings/environments/new +- Name it `pypi` +- Click "Configure environment" + +**Step 2: Add PYPI_TOKEN secret** + +Add your PyPI token to the `pypi` environment: +- In the `pypi` environment settings, scroll to "Environment secrets" +- Click "Add secret" +- Name: `PYPI_TOKEN` (use this exact name) +- Value: Your PyPI API token +- Click "Add secret" + +**Step 3: Commit and push your release branch** + +Ensure your release branch has the correct version set in `ml_metadata/version.py`, then: + +```bash +git add . +git commit -m "Prepare release vX.Y.Z" +git push origin your-release-branch +``` + +### Part 1: Releasing via `workflow_dispatch` + +This method allows you to manually trigger a release from any branch without creating a GitHub release. + +**Steps** (after completing setup above): + +1. Navigate to the GitHub Actions page: https://github.com/google/ml-metadata/actions +2. Find and select the `Build ml-metadata with Conda` workflow: https://github.com/google/ml-metadata/actions/workflows/conda-build.yml +3. Look for "This workflow has a workflow_dispatch event trigger." +4. Click the "Run workflow" dropdown button. +5. Select your release branch from the dropdown menu. +6. Click "Run workflow". + +The workflow will build wheels for all supported Python versions and automatically upload them to PyPI if the token is configured correctly. + +### Part 2: Releasing via GitHub Release + +This method creates a formal GitHub release with a tag, which automatically triggers the build and upload workflow. + +**Steps** (after completing setup above): + +1. Go to the Releases tab: https://github.com/google/ml-metadata/releases +2. Click the `Draft new release` button (you'll be redirected to https://github.com/google/ml-metadata/releases/new) +3. Click the `Select tag` button and create a new tag for your release (e.g., `v1.18.0`) +4. Click the `Target` dropdown and select your release branch +5. Fill in the **Release title** and **Release notes** sections +6. Choose the release type: + - Check `Set as a pre-release` if this is a beta/test release + - Leave unchecked for `Set as the latest release` for stable releases +7. Click the `Publish release` button +8. Verify the workflow is running by going to the Actions tab: https://github.com/google/ml-metadata/actions/workflows/conda-build.yml + +The `Build ml-metadata with Conda` workflow will automatically trigger and build/upload wheels to PyPI if the token is configured correctly. From 3231e0a470320ef49e4326fef516f4e409689c96 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 28 Jan 2026 12:36:39 +0530 Subject: [PATCH 3/6] Fix pypi URL in conda-build.yml --- .github/workflows/conda-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-build.yml b/.github/workflows/conda-build.yml index 07e1d3292..b508429db 100644 --- a/.github/workflows/conda-build.yml +++ b/.github/workflows/conda-build.yml @@ -84,7 +84,7 @@ jobs: needs: [build] environment: name: pypi - url: https://pypi.org/p/ml-metadata-czgdp1807/ + url: https://pypi.org/p/ml-metadata/ steps: - name: Retrieve wheels uses: actions/download-artifact@v4.1.8 From ef4ae68a73283a438ce01dfe72d9f549a73a372b Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 4 Feb 2026 13:16:00 +0530 Subject: [PATCH 4/6] Refine release process documentation for clarity --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index bb98961cd..4cd4a06b3 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ Add your PyPI token to the `pypi` environment: Ensure your release branch has the correct version set in `ml_metadata/version.py`, then: ```bash -git add . +git add ml_metadata/version.py git commit -m "Prepare release vX.Y.Z" git push origin your-release-branch ``` @@ -166,10 +166,9 @@ This method allows you to manually trigger a release from any branch without cre 1. Navigate to the GitHub Actions page: https://github.com/google/ml-metadata/actions 2. Find and select the `Build ml-metadata with Conda` workflow: https://github.com/google/ml-metadata/actions/workflows/conda-build.yml -3. Look for "This workflow has a workflow_dispatch event trigger." -4. Click the "Run workflow" dropdown button. -5. Select your release branch from the dropdown menu. -6. Click "Run workflow". +3. Click the "Run workflow" dropdown button. +4. Select your release branch from the dropdown menu. +5. Click "Run workflow". The workflow will build wheels for all supported Python versions and automatically upload them to PyPI if the token is configured correctly. From 7770433318a4a96108bd703155f16d0bbc193634 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Thu, 5 Feb 2026 14:26:58 +0530 Subject: [PATCH 5/6] Fix sha256 checksum for ZetaSQL --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index 313a86c3e..f7ecd8370 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -253,7 +253,7 @@ http_archive( urls = ["https://github.com/google/zetasql/archive/%s.zip" % ZETASQL_COMMIT], strip_prefix = "zetasql-%s" % ZETASQL_COMMIT, #patches = ["//ml_metadata/third_party:zetasql.patch"], - sha256 = '651a768cd51627f58aa6de7039aba9ddab22f4b0450521169800555269447840' + sha256 = '86f81591ab5ec20457a5394eb2c5c981e6f6c89f4c49c211d096c3acffec1eb1' ) load("@com_google_zetasql//bazel:zetasql_deps_step_1.bzl", "zetasql_deps_step_1") From f0b1bf3382bb79a4da9f5f2dfcd8f40bf9efaac4 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Thu, 5 Feb 2026 14:52:28 +0530 Subject: [PATCH 6/6] Fix strip_prefix for ZetaSQL --- WORKSPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WORKSPACE b/WORKSPACE index f7ecd8370..129a3b712 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -251,7 +251,7 @@ ZETASQL_COMMIT = "ac37cf5c0d80b5605176fc0f29e87b12f00be693" # 08/10/2022 http_archive( name = "com_google_zetasql", urls = ["https://github.com/google/zetasql/archive/%s.zip" % ZETASQL_COMMIT], - strip_prefix = "zetasql-%s" % ZETASQL_COMMIT, + strip_prefix = "googlesql-%s" % ZETASQL_COMMIT, #patches = ["//ml_metadata/third_party:zetasql.patch"], sha256 = '86f81591ab5ec20457a5394eb2c5c981e6f6c89f4c49c211d096c3acffec1eb1' )