| Crates.io | konsti-bar |
| lib.rs | konsti-bar |
| version | 0.1.0 |
| created_at | 2025-11-20 18:47:47.180859+00 |
| updated_at | 2025-11-20 18:47:47.180859+00 |
| description | Main crate for demonstrating trusted publishing issue |
| homepage | |
| repository | https://github.com/example/konsti-bar |
| max_upload_size | |
| id | 1942422 |
| size | 4,779 |
Minimal reproducible example for Publishing from a subdirectory issue.
This is a Rust workspace with two crates:
konsti-bar - Main crate at the repository rootkonsti-foo - Helper crate in a subdirectoryBoth crates have proper metadata (description, license, repository) and are ready to publish.
When attempting to publish konsti-foo using GitHub Actions with trusted publishing, the workflow fails with:
Error: Failed to retrieve token from Cargo registry. Status: 400.
Error: The Trusted Publishing config for repository `konsti-bar` does not match
the workflow filename `publish-konsti-foo.yml` in the JWT.
Expected workflow filenames: `publish-konsti-bar.yml`
The Cargo registry's trusted publishing validation checks the workflow filename in the JWT against the configured workflow filenames. When you configure trusted publishing for a repository, it associates the workflow filename with the main crate. When you try to publish a subdirectory crate with a different workflow filename, validation fails.
konsti-bar with workflow publish-konsti-bar.ymlkonsti-foo using the publish-konsti-foo.yml workflow.github/workflows/publish-konsti-bar.yml - Works correctly for main crate.github/workflows/publish-konsti-foo.yml - Fails due to workflow name mismatchTrusted publishing should support publishing subdirectory crates with their own workflow files, or allow specifying multiple workflow filenames in the trusted publishing configuration.
Use a single workflow file that publishes both crates conditionally, but this couples the release process of independent crates.