Skip to content

feat: renew publishing to PyPI - #1086

Merged
UladzislauK-Writer merged 1 commit into
devfrom
vlad/pypi
Aug 18, 2025
Merged

feat: renew publishing to PyPI#1086
UladzislauK-Writer merged 1 commit into
devfrom
vlad/pypi

Conversation

@UladzislauK-Writer

@UladzislauK-Writer UladzislauK-Writer commented Aug 18, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Chores
    • Publish workflow now triggers on a single agent-builder image tag pattern for releases.
    • CI extracts the release version from the tag during publish runs and fails early if parsing fails.
    • The publishing process updates the project version from the extracted value before publishing, ensuring published artifacts match the tag.

@coderabbitai

coderabbitai Bot commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The publish workflow now triggers on agent-builder-<ver>-image-<ver>-main tags, extracts the primary version from the tag with a Bash regex, logs it, updates the Poetry project version, and aborts early if parsing fails.

Changes

Cohort / File(s) Summary
CI Workflow Triggers and Version Handling
.github/workflows/publish.yml
Updated tag trigger to agent-builder-[0-9]+.[0-9]+.[0-9]+-image-[0-9]+.[0-9]+.[0-9]+-main. Added steps: extract_version (Bash regex parses tag, writes version to GITHUB_OUTPUT, exits on failure), Show extracted version (echoes output), and Update version before publishing (poetry version to set project version). Steps placed after checkout and before publish.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Git Tag (agent-builder-*-image-*-main)
  participant GH as GitHub Actions
  participant Extract as Extract version from tag
  participant Echo as Show extracted version
  participant Poetry as Poetry CLI
  participant Publish as Publish Step

  Dev->>GH: Push tag
  GH->>Extract: Run Bash regex to parse tag
  alt Parse success
    Extract-->>GH: set outputs.version
    GH->>Echo: echo Version is <version>
    GH->>Poetry: poetry version <version>
    GH->>Publish: run publish
  else Parse failure
    Extract-->>GH: log error and exit (job fails)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I twitched my whiskers at a tag so fine,
I parsed the numbers, one, two, three in line.
I shouted the version with a joyous hop,
Set Poetry’s badge — then off we pop! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vlad/pypi

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@hackerone-code hackerone-code Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 This pull request has been sent to HackerOne's PullRequest review team because our automation detected one or more changes with potential security impact or requires further evaluation. Experts are now being assigned to this review based on relevant expertise and will validate or dismiss any security findings accordingly and post their feedback as comments within this pull request.

⏱️ Latest scan covered changes up to commit cf2073c (latest)


Check the status or cancel this secure code review here.

@hackerone-code hackerone-code Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Graham C reviewed all the included code changes and associated automation findings and determined that there were no immediately actionable security flaws. Note that they will continue to be notified of any new commits or comments and follow up as needed throughout the duration of this pull request's lifecycle.

Image of Graham C Graham C


Reviewed with ❤️ by PullRequest

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
.github/workflows/publish.yml (2)

23-24: Optional: downgrade to a notice or remove the echo for quieter logs

Echoing the version is fine; consider using a workflow command notice or removing it to keep logs clean.

Example:

-              run: echo "Version is ${{ steps.extract_version.outputs.version }}"
+              run: echo "::notice title=Version::${{ steps.extract_version.outputs.version }}"

46-47: Consider updating the version earlier in the job

If any generation step embeds the project version, updating only right before publish might produce mismatched artifacts. Safer sequence:

  • Checkout
  • Extract and validate version
  • poetry version
  • Install/generate/build/publish

I can propose a reordered step layout if you want to move this earlier in the workflow.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between faa354d and cf2073c.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml (3 hunks)
⏰ 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). (13)
  • GitHub Check: build (3.12)
  • GitHub Check: build (3.13)
  • GitHub Check: build (3.11)
  • GitHub Check: build (3.9)
  • GitHub Check: build (3.10)
  • GitHub Check: tests (webkit)
  • GitHub Check: tests (chromium)
  • GitHub Check: tests (firefox)
  • GitHub Check: build (3.9)
  • GitHub Check: build (3.13)
  • GitHub Check: build (3.11)
  • GitHub Check: build (3.12)
  • GitHub Check: build (3.10)

Comment thread .github/workflows/publish.yml
Comment thread .github/workflows/publish.yml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/publish.yml (2)

6-6: Consider adding least-privilege permissions and concurrency guard

Optional hardening:

  • Set workflow permissions to read-only (prevents accidental write access via GITHUB_TOKEN).
  • Add concurrency to avoid double-publishing on duplicated/tagged runs.

Add these snippets:

YAML (top-level after name:):

permissions:
  contents: read

YAML (under jobs.build:):

concurrency:
  group: publish-${{ github.ref }}
  cancel-in-progress: true

16-26: Minor hardening: enable strict bash options; optionally expose image version too

Not critical, but set -euo pipefail adds safety, and capturing the second group can be useful for logging/diagnostics later.

Apply this diff:

               run: |
-                REF="${{ github.ref_name }}"
+                set -euo pipefail
+                REF="${{ github.ref_name }}"
                 if [[ "$REF" =~ ^agent-builder-([0-9]+\.[0-9]+\.[0-9]+)-image-([0-9]+\.[0-9]+\.[0-9]+)-main$ ]]; then
-                  echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
+                  echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
+                  echo "image_version=${BASH_REMATCH[2]}" >> "$GITHUB_OUTPUT"
                 else
                   echo "Unable to parse version from tag: $REF" >&2
                   exit 1
                 fi
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cf2073c and 32827d8.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-18T10:46:57.535Z
Learnt from: UladzislauK-Writer
PR: writer/writer-framework#1086
File: .github/workflows/publish.yml:6-6
Timestamp: 2025-08-18T10:46:57.535Z
Learning: GitHub Actions on.push.tags filters support glob patterns that include the `+` character along with *, **, ?, ! and others. The `+` character works in glob patterns for GitHub Actions, not just as a regex quantifier.

Applied to files:

  • .github/workflows/publish.yml
⏰ 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). (13)
  • GitHub Check: tests (firefox)
  • GitHub Check: build (3.13)
  • GitHub Check: build (3.11)
  • GitHub Check: tests (webkit)
  • GitHub Check: build (3.10)
  • GitHub Check: build (3.12)
  • GitHub Check: tests (chromium)
  • GitHub Check: build (3.9)
  • GitHub Check: build (3.12)
  • GitHub Check: build (3.9)
  • GitHub Check: build (3.13)
  • GitHub Check: build (3.10)
  • GitHub Check: build (3.11)
🔇 Additional comments (4)
.github/workflows/publish.yml (4)

6-6: Trigger tag glob looks correct

The glob with + quantifiers and digit classes is valid for GitHub Actions tag filters. This should match your intended tags.


16-26: Robust version parsing and fail-fast behavior LGTM

Good use of a strict Bash regex with BASH_REMATCH and early exit on mismatch. This prevents accidental invalid versions reaching Poetry.


27-28: Echo step is fine for visibility

Lightweight confirmation of the extracted version; harmless and useful in logs.


44-45: No monorepo risk: single pyproject.toml detected
The repository contains exactly one pyproject.toml, so running poetry version at the root will target the correct project. No additional working-directory: or poetry -C <path> flags are required.

@UladzislauK-Writer
UladzislauK-Writer merged commit 8ad8a14 into dev Aug 18, 2025
20 checks passed
@UladzislauK-Writer
UladzislauK-Writer deleted the vlad/pypi branch August 18, 2025 11:10
@coderabbitai coderabbitai Bot mentioned this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants