-
Notifications
You must be signed in to change notification settings - Fork 172
Add PyPI Release Documentation #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
czgdp1807
wants to merge
3
commits into
google:master
Choose a base branch
from
czgdp1807:token-release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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." | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This step is unnecessary, as the users can simply click on the "Run workflow" button directly. |
||
| 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. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to specify to only add the intended file (
ml_metadata/version.py), instead of add all.