Repository navigation
Publish links-queue to crates.io with trusted publishing (token fallback) - #54
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #53
Tries the trusted publishing token passed by the workflow, falls back to the CARGO_REGISTRY_TOKEN / CARGO_TOKEN secret, skips versions already on crates.io, explains missing or rejected credentials and verifies that crates.io serves the published version.
Add id-token: write, rust-lang/crates-io-auth-action pinned to v1.0.6 with continue-on-error, and a publish step using the OIDC token or the CARGO_REGISTRY_TOKEN / CARGO_TOKEN fallback to both release jobs. Fix the release job conditions: a skipped job in the dependency chain (changelog on push, detect-changes on workflow_dispatch) skipped Auto Release and Manual Release, so no Rust version was ever released. Release versions that are tagged but missing from crates.io, run cargo publish --dry-run in CI and keep release tooling out of the crate.
Working session summaryPR #54 is ready for review: #54. I chose to publish links-queue to crates.io rather than set Why publish: it's a library plus a command-line tool, the docs already link to What changed in
Publishing happens before the GitHub release is created. If no credential works, the job fails with a message saying exactly what to set up. That logic is in a new script,
Smaller changes:
Tests: 11 unit tests for the new script, also run in CI, and a script in Still needed from a maintainer: crates.io only lets you register a trusted publisher for a crate that already exists, so the first version needs one of these:
Until one of these is done, the release job on This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $1.831127📊 Context and tokens usage:
Total: (86 new + 79.2K cache writes + 2.6M cache reads) input tokens, 34.3K output tokens, $1.831127 cost 🤖 Models used:
📎 Log file uploaded as Gist (1383KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🎉 Auto-mergedThis pull request has been automatically merged by hive-mind.
Linked issues |
Summary
Fixes #53
Decision: links-queue is meant for crates.io. It is a library plus a CLI binary, and the docs already send users to crates.io (
docs/README.mdlinkshttps://crates.io/crates/links-queue, and the install guides saylinks-queue = "0.11"). The name is still free on crates.io (GET /api/v1/crates/links-queue→crate links-queue does not exist). So instead ofpublish = false, this PR adds a crates.io release path that follows the 2026-10-13 policy comment: trusted publishing (OIDC) first, with a token fallback.Release pipeline (
.github/workflows/rust.yml)Auto ReleaseandManual Releasenow haveid-token: writeand these steps:rust-lang/crates-io-auth-action@3268eb413133e2960fa4ae0e963ca76380c54cd9 # v1.0.6. That is the newest release; I checked thatv1.0.6andv1both resolve to this SHA. The step hascontinue-on-error: true.CARGO_REGISTRY_TOKEN: ${{ steps.crates_auth.outputs.token || secrets.CARGO_REGISTRY_TOKEN || secrets.CARGO_TOKEN }}.::error::that explains what to do: runpackage-registry-manager setup --repository . --registry crates-io --executefor the first version, register the trusted publisher (ownerlink-foundation, repositorylinks-queue, workflowrust.yml, no environment), or add theCARGO_REGISTRY_TOKENsecret. Nothing is hidden bycontinue-on-error.rust/scripts/crates-io.mjs(Node built-ins only), with two commands:status: is theCargo.tomlversion already on crates.io?publish: skips versions that are already published, warns when it falls back to the token, runscargo publish, treats "already uploaded/exists" as success, and polls crates.io afterwards.Root-cause fix: Rust releases never ran
Every Rust run on
mainskippedAuto Release. For example, run 37563629623 shows lint/test/buildsuccessbutAuto Release skipped, and the repository has norust-v*tag. The job condition had no status function, so the job was skipped because one of its dependencies was skipped:changelogon push. The same thing happened tolint(and through it,Manual Release) onworkflow_dispatch, wheredetect-changesis skipped. I fixed this with thealways() && … needs.build.result == 'success'pattern thatjs.ymlalready uses. Without this fix the new publish step would never have run.Robustness
main. Before, "tag exists" alone meant "already released".Cargo.toml.cargo publish --dry-run. I checked that it only warns, and does not fail, once a version exists.Cargo.tomlexcludeschangelog.d/,scripts/andpackage-lock.jsonfrom the crate (86 → 75 files).Docs
rust/README.md: installation (cargo add/cargo install) and a Releasing section covering the one-time first-publish setup.docs/now saylinks-queue = "0.3"instead of the non-existent0.11.patch).One-time maintainer action (cannot be done from CI or this PR)
crates.io can only register a trusted publisher for a crate that already exists. So the first version needs one of these:
package-registry-manager setup --repository . --registry crates-io --execute, as step 2 of the issue says. It publishes the first version with a short-lived token and registers the trusted publisher. orCARGO_REGISTRY_TOKENsecret before merging. The first release then publishes through the fallback; afterwards, register the trusted publisher.Until one of these is done, the
Auto Releasejob onmainwill fail with the instructions above. That is intentional. Every later version publishes from CI with no secret.How to reproduce / verify
node --test rust/scripts/crates-io.test.mjs: 11 unit tests, also run in the CI lint job. They coverCargo.tomlparsing (the package name, not the[lib]name), a guard thatpublish = falseis not set, the trusted-publisher text, classification ofcargo publishfailures, the help messages, and how crates.io status codes map totrue/false/unknown.experiments/issue-53-crates-io-publish-paths.shexercises the paths against the real crates.io without uploading anything:status→published=falseserde 1.0.0) → skipped and verified, exit 0cargo fmt --check,cargo clippy --all-targets --all-featureswith-Dwarnings,cargo test --all-features(513 passed, 0 failed),cargo publish --dry-runandactionlintonrust.ymlall pass.