feat: create initial release workflow for automated pypi publishing#28
feat: create initial release workflow for automated pypi publishing#28Krishna-kg732 wants to merge 8 commits into
Conversation
Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
chore:Updated release workflow
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a documented and automated release process to publish kubeflow-mcp to Test PyPI (manual) and PyPI (on GitHub Release), using PyPI trusted publishing (OIDC) instead of API tokens.
Changes:
- Introduces a GitHub Actions
Releaseworkflow to build, test, and publish to Test PyPI / PyPI via OIDC. - Adds release documentation describing versioning rules, release paths, and trusted publisher setup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/release/RELEASE.md | Documents the release process, prerequisites, and trusted publishing configuration. |
| .github/workflows/release.yaml | Automates build/test/package validation and publishing to Test PyPI/PyPI and attaching release assets. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Check version and release target | ||
| id: vars | ||
| env: | ||
| RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
| run: | | ||
| python - <<'PY' | ||
| import ast | ||
| import os | ||
| from pathlib import Path | ||
| import re | ||
| import tomllib |
| python - <<'PY' | ||
| import ast | ||
| import os | ||
| from pathlib import Path | ||
| import re | ||
| import tomllib | ||
|
|
||
| with open("pyproject.toml", "rb") as f: | ||
| project = tomllib.load(f)["project"] |
| module = ast.parse(open("kubeflow_mcp/__init__.py", encoding="utf-8").read()) | ||
| code_version = None | ||
| for node in module.body: | ||
| if ( | ||
| isinstance(node, ast.Assign) | ||
| and len(node.targets) == 1 | ||
| and isinstance(node.targets[0], ast.Name) | ||
| and node.targets[0].id == "__version__" | ||
| and isinstance(node.value, ast.Constant) | ||
| and isinstance(node.value.value, str) | ||
| ): | ||
| code_version = node.value.value | ||
| break |
|
Thanks @Krishna-kg732 for working on this! A few small items before /lgtm - happy to merge after these. |
|
|
||
| - name: Setup build environment | ||
| run: | | ||
| make verify |
There was a problem hiding this comment.
I think we can add uv sync --extra dev (or make install) before make verify .. bare checkout won't have deps, wdyt?
| with: | ||
| verbose: true | ||
|
|
||
| github-release: |
There was a problem hiding this comment.
IIUC github-release job runs on release: published then calls softprops/action-gh-release to create a release .. release already exists. what if we use upload_url from github.event.release to attach dist/* assets instead
| else: | ||
| target_ref = os.environ["GITHUB_REF"] | ||
|
|
||
| is_prerelease = bool(re.search(r"(?:dev|rc)", project_version, re.IGNORECASE)) |
There was a problem hiding this comment.
is_prerelease regex (?:dev|rc) misses a, b, alpha, beta .. what does SDK release workflow use? maybe can also use PEP 440 parsing ?
There was a problem hiding this comment.
yeah okayy , I will change that
| name: ${{ needs.prepare.outputs.artifact-name }} | ||
| path: dist/ | ||
|
|
||
| publish-test-pypi: |
There was a problem hiding this comment.
IIUC workflow_dispatch can publish any branch to Test PyPI with no tag match.. maybe consider requiring version in branch name or manual input
There was a problem hiding this comment.
Thanks @Krishna-kg732 , version input validation helps but I afraid you can't publish without matching both files. But we should also add a branches filter to lock workflow_dispatch to main and release-*.
that weill prevent someone accidentally publishing a feature branch to Test PyPI. One-line fix:
workflow_dispatch:
branches: [main, 'release-*']
There was a problem hiding this comment.
cool , makes sense
will update it
|
PR description mentions about scripts/check_version.py exists ? |
…workflow Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
| .PHONY: format | ||
| format: ## Auto-fix lint and formatting issues | ||
| @uv run ruff check --fix . | ||
| @uv run ruff format . |
There was a problem hiding this comment.
Duplicate format target.. it seems this block adds a format: target without --group dev, then the existing one follows with --group dev. Make uses the last definition, so this block is dead code. Please remove it.
| print(f"pyproject.toml: {project_version}") | ||
| print(f"__init__.py: {code_version}") | ||
|
|
||
| if project_version != code_version: |
There was a problem hiding this comment.
--release-tag comparison doesn't strip a v prefix. If someone tags v0.1.0 (very common convention), this check fails against 0.1.0 in pyproject.toml.
There was a problem hiding this comment.
Either strip the prefix: tag = args.release_tag.removeprefix("v") or document in RELEASE.md that tags must be bare versions (no v).
There was a problem hiding this comment.
workflow_dispatch should have a branches.. filter restricting to main and release-*.
There was a problem hiding this comment.
Without this, any branch can trigger a Test PyPI publish. Since v0.1.0 is imminent, this is worth adding now even if the full release-branch workflow (cherry-picks, branch protection) is follow-up scope.
wdyt?
There was a problem hiding this comment.
This is not yet resolved.. workflow_dispatch.branches is ignored by GitHub Actions, so feature branches can still publish to Test PyPI. Please add a job-level 'if' (or fail step) locking dispatch to 'main' + 'release-*' only.
|
also can you fix PR title to pass Check PR Title .. ⬆️ |
Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
|
/ok-to-test |
|
Almost there, fork Test PyPI run looks good. 🙌 One blocker before /lgtm: workflow_dispatch.branches is ignored by GitHub Actions, so feature branches can still publish to Test PyPI. Please add a job-level 'if' (or fail step) locking dispatch to 'main' + 'release-*' only. After that I'm happy to /lgtm. @Krishna-kg732 QQ: after the PR merges, someone with admin on kubeflow/mcp-server must create two GitHub Environments and wire them to Test PyPI / PyPI or the publish jobs will fail even though the workflow YAML is correct.. right? |
|
@andreyvelich @thesuperzapper @kramaranya Once above reviews resolved, happy to /lgtm. |
Signed-off-by: Krishna Gupta <Krishnagupta.kg2k6@gmail.com>
yes , the release will fail if the github environment is not configured. workflow dryrun with test-PyPi : test PyPi : https://test.pypi.org/project/kubeflow-mcp-krishna-kg732 it will default to the test pypi workflow. |
Add automated PyPI release pipeline
Adds a documented release workflow for
kubeflow-mcpwith pre-production and production publish paths.What's included
release.yaml— GitHub Actions workflow with two triggers:workflow_dispatch→ builds and publishes RC/dev builds to Test PyPIrelease: published→ publishes stable tags to PyPIscripts/check_version.py— fails the build ifpyproject.tomlandkubeflow_mcp/__init__.pyversions don't matchRELEASE.md— maintainer checklist for both pre-prod and prod flowsKey behaviour
rc/dev) are blocked from production PyPI by default; maintainers can override viaforce_prodinputdry_runmode builds and verifies without uploadingOut of scope
Release branches, auto cherry-picks, and per-minor CHANGELOG automation (tracked separately).
Closes
#16
cc: @abhijeet-dhumal