Skip to content

ci(core): automate Rust core crate releases via release-please - #2462

Merged
douenergy merged 2 commits into
mainfrom
feat/rust-crate-release-please
Jul 10, 2026
Merged

douenergy merged 2 commits into
mainfrom
feat/rust-crate-release-please

Conversation

@goldmedal

@goldmedal goldmedal commented Jul 10, 2026 •

Copy link
Copy Markdown
Collaborator

What & why

The Rust core crates were published to crates.io manually. This adds an automated release
line for them via release-please + a reusable publish workflow, matching how the Python
(wren-core-py, wren) and npm (wren-core-wasm) packages are already released.

Three publishable crates form a bottom-up dependency chain:

crates.io name path depends on
wren-manifest-macro core/wren-core-base/manifest-macro —
wren-core-base core/wren-core-base wren-manifest-macro
wren-semantic-core core/wren-core (workspace member core) wren-core-base

Changes

  • release-please-config.json — add the three crates as release-type: rust packages,
    grouped with the linked-versions plugin so they always share one version and land in a
    single release PR. Cross-crate pinned dependency requirements are kept in sync with
    type: "toml" extra-files updaters (same mechanism already used for the uv.lock bumps).
  • .release-please-manifest.json — seed the three paths at the current 0.1.0.
  • .github/workflows/publish-wren-crates.yml (new) — reusable workflow that publishes the
    chain bottom-up in one run. Uses crates.io Trusted Publishing (rust-lang/crates-io-auth-action,
    OIDC, no stored token) — the same token-less pattern as the PyPI/npm publishers. cargo publish
    blocks until each crate is live on the index before the next, so the pinned deps resolve in order.
  • .github/workflows/release-please.yml — expose the wren-semantic-core outputs and add a
    publish-wren-crates job gated on release_created (linked crates release together, so gating
    on the top crate covers all three).

Verification

  • cargo publish --dry-run passes for all three crates (each packages and builds cleanly).
  • actionlint clean on both workflow files.
  • release-please release-pr --dry-run against this branch parses the config and resolves all
    three new packages as rust with the linked-versions plugin, no errors.

Follow-up (one-time, repo-admin — not in this PR)

Trusted Publishing needs a one-time setup before the first automated publish:

  1. On crates.io, add a Trusted Publisher for each of the three crates → repo Canner/WrenAI,
    workflow publish-wren-crates.yml, environment crates-io.
  2. Create the crates-io GitHub environment under repo Settings → Environments (mirrors the
    existing npm / pypi environments).

Summary by CodeRabbit

  • New Features
    • Added automated crates.io publishing for the core Rust crates when a semantic core release is created.
    • Extended automated release metadata to propagate version and tag details for downstream publishing.
    • Ensured publish runs in the correct dependency order to support successful crate releases.
  • Chores
    • Improved release automation configuration to include additional core components and linked version extraction.
    • Enabled secure, tokenless authentication and build caching during publishing.

The Rust core crates (wren-manifest-macro, wren-core-base, wren-semantic-core)
were published to crates.io manually. Add them as release-please packages so
future versions cut a release PR and publish on merge, matching how the Python
and npm packages are already released.

The three crates share one version via the linked-versions plugin and publish
bottom-up in a single reusable workflow using crates.io Trusted Publishing
(OIDC, no stored token) — the same token-less pattern as the PyPI/npm publishers.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions github-actions Bot added the ci label Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5054f52a-04e0-462b-8998-5ca6ec3fe8c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Adds release-please tracking for three Rust crates and connects semantic-core releases to a reusable GitHub Actions workflow that authenticates with crates.io and publishes the crates in dependency order.

Changes

Rust crate release automation

Layer / File(s) Summary
Rust component release configuration
.release-please-manifest.json, release-please-config.json
Release-please tracks the three Rust packages, extracts their Cargo versions, and links their component versions.
Release output wiring
.github/workflows/release-please.yml
The release job exposes semantic-core versioning outputs and invokes crate publishing when a semantic-core release is created.
Sequential crates.io publishing
.github/workflows/publish-wren-crates.yml
The reusable workflow checks out the release tag, authenticates through OIDC, and publishes the manifest macro, core base, and semantic core crates sequentially.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ReleasePlease
  participant PublishWrenCrates
  participant CratesIO
  ReleasePlease->>PublishWrenCrates: invoke with version and tag_name
  PublishWrenCrates->>CratesIO: authenticate with OIDC
  PublishWrenCrates->>CratesIO: publish wren-manifest-macro
  PublishWrenCrates->>CratesIO: publish wren-core-base
  PublishWrenCrates->>CratesIO: publish wren-semantic-core
Loading

Possibly related PRs

Suggested reviewers: grieve54706

Poem

I’m a rabbit with crates in a row,
Tag them and watch the workflows go.
Macro first, then core takes flight,
Semantic follows by release night.
OIDC lights the publishing way—
Hop, hop, shipped to crates.io today!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: automating Rust core crate releases with release-please and CI publishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/rust-crate-release-please

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

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

@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: 1

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

31-33: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Set persist-credentials: false on checkout

The checkout action persists the GitHub token in .git/config after checkout. No subsequent step needs git auth, so disabling credential persistence reduces the exposure surface.

🔒️ Proposed fix
       - uses: actions/checkout@v4
         with:
           ref: ${{ inputs.tag_name }}
+          persist-credentials: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-wren-crates.yml around lines 31 - 33, Update the
checkout step using actions/checkout@v4, identified by its ref input, to set
persist-credentials: false in the with configuration.

Source: Linters/SAST tools


22-29: 🔒 Security & Privacy | 🔵 Trivial

Register crates.io Trusted Publisher with the caller workflow path

When using reusable workflows with OIDC Trusted Publishing, GitHub Actions' job_workflow_ref claim resolves to the caller workflow (.github/workflows/release-please.yml), not the reusable callee (.github/workflows/publish-wren-crates.yml). Ensure the crates.io Trusted Publisher is registered with the caller workflow path during the one-time setup mentioned in the PR summary. Based on learnings from this repo's PyPI Trusted Publishing workflows, the same OIDC job_workflow_ref behavior applies. As per coding guidelines from the retrieved learning, this is expected behavior and not a defect in the reusable workflow structure.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-wren-crates.yml around lines 22 - 29, Register the
crates.io Trusted Publisher against the caller workflow path
“.github/workflows/release-please.yml”, since OIDC job_workflow_ref identifies
the invoking workflow rather than the reusable publish workflow. Keep the
existing reusable workflow structure and permissions unchanged, and update the
one-time Trusted Publisher setup documentation or instructions accordingly.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@release-please-config.json`:
- Around line 72-83: Update the `core/wren-core` configuration in
`release-please-config.json` to use `release-type: "simple"` instead of
`"rust"`, and add an `extra-files` entry targeting `Cargo.toml` with `jsonpath:
"$.workspace.package.version"` while retaining the existing
`$.workspace.dependencies.wren-core-base.version` entry.

---

Nitpick comments:
In @.github/workflows/publish-wren-crates.yml:
- Around line 31-33: Update the checkout step using actions/checkout@v4,
identified by its ref input, to set persist-credentials: false in the with
configuration.
- Around line 22-29: Register the crates.io Trusted Publisher against the caller
workflow path “.github/workflows/release-please.yml”, since OIDC
job_workflow_ref identifies the invoking workflow rather than the reusable
publish workflow. Keep the existing reusable workflow structure and permissions
unchanged, and update the one-time Trusted Publisher setup documentation or
instructions accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 6e60abd8-990a-4698-8a49-4d1ccfb5652a

📥 Commits

Reviewing files that changed from the base of the PR and between 0ba4fae and 2100067.

📒 Files selected for processing (4)
  • .github/workflows/publish-wren-crates.yml
  • .github/workflows/release-please.yml
  • .release-please-manifest.json
  • release-please-config.json

Comment thread release-please-config.json Resolved
core/wren-core is a virtual Cargo workspace (no [package]; the crate inherits
version.workspace = true), which the rust release-type cannot bump. Switch it to
release-type: simple and drive the shared [workspace.package].version through an
extra-files TOML updater, keeping the wren-core-base dependency pin in sync.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@goldmedal
goldmedal requested a review from douenergy July 10, 2026 03:19
@goldmedal

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Pushed bb557cb addressing the workspace-version finding: core/wren-core is now release-type: simple with the shared [workspace.package].version driven via an extra-files TOML updater ($.workspace.package.version), since it's a virtual workspace that the rust strategy can't bump. Verified with a release-please dry-run — all three crates bump in lockstep and the workspace version + wren-core-base dep pin update correctly.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh pr view 2462 --repo Canner/WrenAI --json title,body,state,commits 2>&1 | head -100
echo "---"
gh pr diff 2462 --repo Canner/WrenAI > /tmp/pr.diff 2>&1
wc -l /tmp/pr.diff
echo "---"
cat /tmp/pr.diff

Length of output: 12224


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo "== core/wren-core/Cargo.toml =="
cat core/wren-core/Cargo.toml 2>&1 | head -60
echo "== core/wren-core/core/Cargo.toml =="
cat core/wren-core/core/Cargo.toml 2>&1 | head -60
echo "== core/wren-core-base/Cargo.toml =="
cat core/wren-core-base/Cargo.toml 2>&1 | head -60
echo "== core/wren-core-base/manifest-macro/Cargo.toml =="
cat core/wren-core-base/manifest-macro/Cargo.toml 2>&1 | head -60
echo "== ls core/wren-core =="
fd . core/wren-core -d 1

Length of output: 5075


🏁 Script executed:

#!/bin/bash
set -euo pipefail
gh api repos/Canner/WrenAI/pulls/2462/comments --paginate | jq -r '.[] | select(.user.login=="coderabbitai[bot]") | "\(.path):\(.line // .original_line) \n\(.body)\n---"' | head -300

Length of output: 10068


This confirms the fix in bb557cb correctly resolves the earlier finding — core/wren-core is now release-type: "simple" with extra-files targeting $.workspace.package.version, plus the existing $.workspace.dependencies.wren-core-base.version entry to keep the pin in sync. I cross-checked against the actual files:

  • core/wren-core/Cargo.toml is indeed a virtual workspace ([workspace] + [workspace.package], no [package]), confirming the rust release-type couldn't have bumped it.
  • core/wren-core/core/Cargo.toml correctly uses version = { workspace = true }, so bumping the workspace root's [workspace.package].version propagates to the crate.
  • The dependency pin wren-core-base = { path = "../wren-core-base", version = "0.1.0" } under [workspace.dependencies] in the workspace root is exactly what the second extra-files entry ($.workspace.dependencies.wren-core-base.version) targets.
  • The linked-versions plugin still groups wren-manifest-macro, wren-core-base, and wren-semantic-core, so lockstep bumping is preserved.
  • Bottom-up publish order in publish-wren-crates.yml (manifest-macro → wren-core-base → core/wren-core/core/Cargo.toml) still lines up correctly with this change.

This matches the documented pattern for release-please with Cargo workspace version inheritance (switching to simple + TOML extra-files when version.workspace = true is used), so the fix is sound. Nice work confirming it with a dry-run.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@douenergy
douenergy merged commit 60a934e into main Jul 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants