-
Notifications
You must be signed in to change notification settings - Fork 127
chore(ci): add workflow to publish dev Python SDK #3572
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughReplaces the Dagger-based Python SDK generation workflow by deleting Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant GH as GitHub Actions
participant Repo as Repository
participant Nix as Nix Tooling
participant PyPI as PyPI
note over GH,Repo #E8F6FF: New beta release workflow
GH->>Repo: checkout code
GH->>Repo: compute short SHA (12 chars) -> output `COMMIT_SHORT_SHA`
GH->>Nix: setup Nix (action)
GH->>Nix: restore Nix store cache (layered keys)
GH->>Nix: run `nix develop ... publish-python-sdk` (env: `PY_SDK_RELEASE_TAG=alpha`, `COMMIT_SHORT_SHA`, `PYPI_TOKEN`)
Nix->>PyPI: publish pre-release package (uses `PYPI_TOKEN`)
PyPI-->>GH: publish result (success/failure)
sequenceDiagram
autonumber
participant GH as GitHub Actions
participant Repo as Repository
participant Dagger as Dagger (removed)
note over GH,Repo #FFF3E0: Old generation workflow (removed)
GH->>Repo: checkout code
GH->>Dagger: run `generate python-sdk -o api/client/python` (with cloud token & `DAGGER_VERSION`)
Dagger->>Repo: write generated SDK
GH->>GH: create pull request from `openapi/python-sdk` (create-pull-request)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/sdk-python-dev-release.yaml (1)
6-10: Consider the intended trigger frequency.The workflow triggers on every
pushtomain, which could result in a dev release for each commit. Is this the desired behavior, or should it beworkflow_dispatchonly or run on a schedule? If frequent releases are intended, that's fine—just wanted to flag it for confirmation.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
api/client/python/Makefileis excluded by!api/client/**api/client/python/openmeter/_version.pyis excluded by!api/client/**
📒 Files selected for processing (2)
.github/workflows/sdk-python-dev-release.yaml(1 hunks).github/workflows/sdk-python.yaml(0 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/sdk-python.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Repository Scan
- GitHub Check: Artifacts / Benthos Collector Container image
- GitHub Check: Artifacts / Container image
- GitHub Check: Lint
- GitHub Check: Build
- GitHub Check: Migration Checks
- GitHub Check: Code Generators
- GitHub Check: Test
- GitHub Check: Analyze (go)
🔇 Additional comments (1)
.github/workflows/sdk-python-dev-release.yaml (1)
50-54: No issues found—version handling is intentional and working correctly.The
1.0.0a0base version in the workflow is the intended pattern for dev releases. The Makefile'spublish-python-sdktarget dynamically generatesopenmeter/_version.pyand updatespyproject.tomlusing thePY_SDK_RELEASE_VERSIONenv var passed from the workflow. The placeholder0.0.0in the source files gets overwritten at build time, and the SHA ensures each dev build is uniquely versioned. This is a solid approach for pre-release versioning.
| - name: Checkout repository | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| persist-credentials: false |
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.
The checkout will fail on push events due to empty github.head_ref.
github.head_ref is only populated for pull request events and will be empty for push events. When this workflow triggers on push to main (line 8-10), the checkout will attempt to use an empty ref, which will fail.
Remove the ref line to default to ${{ github.sha }}, or explicitly use that:
- name: Checkout repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
- ref: ${{ github.head_ref }}
persist-credentials: falseAlternatively, if you specifically need the head_ref for some reason, constrain the trigger to workflow_dispatch only (remove the push trigger).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Checkout repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| persist-credentials: false | |
| - name: Checkout repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false |
🤖 Prompt for AI Agents
In .github/workflows/sdk-python-dev-release.yaml around lines 18 to 22, the
checkout step uses ref: ${{ github.head_ref }} which is empty on push events and
will cause checkout to fail; remove the ref line so actions/checkout defaults to
the commit (or replace it with ref: ${{ github.sha }}), or if you truly need
head_ref restrict the workflow triggers to PR events or workflow_dispatch only;
update the step accordingly and ensure persist-credentials remains unchanged.
d0f3603 to
d8ac23e
Compare
d8ac23e to
9830d0d
Compare
NOTE:
Remove
--dry-runwhen Python SDK interface is in a good state.Summary by CodeRabbit