Skip to content

feat: add cargo publish reusable workflow - #26

Open
bshek-xitaso wants to merge 1 commit into
csaf-rs:mainfrom
bshek-xitaso:feat/cargo-publish-workflow
Open

feat: add cargo publish reusable workflow#26
bshek-xitaso wants to merge 1 commit into
csaf-rs:mainfrom
bshek-xitaso:feat/cargo-publish-workflow

Conversation

@bshek-xitaso

@bshek-xitaso bshek-xitaso commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Note: A new tag should be created after the merge.

This PR addresses #18.

It adds a reusable workflow for publishing Rust packages to crates.io.

The optional environment input preserves the release environment used by vers-rs, while callers without an environment can omit it.

@peinjoh
peinjoh requested a balanced review from Copilot August 24, 2026 14:19
@bshek-xitaso
bshek-xitaso marked this pull request as ready for review August 24, 2026 14:20

Copilot AI 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.

Pull request overview

Adds a reusable GitHub Actions workflow for publishing Rust crates to crates.io with optional environment protection.

Changes:

  • Adds OIDC-based crates.io authentication.
  • Supports optional GitHub environments.
  • Publishes locked Rust packages with submodules enabled.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bshek-xitaso
bshek-xitaso marked this pull request as draft August 24, 2026 14:36
@bshek-xitaso
bshek-xitaso marked this pull request as ready for review August 24, 2026 14:51
@peinjoh

peinjoh commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Please pin the two used actions

@bshek-xitaso
bshek-xitaso marked this pull request as draft August 25, 2026 07:13
@bshek-xitaso
bshek-xitaso force-pushed the feat/cargo-publish-workflow branch 2 times, most recently from 10c608a to 7943f06 Compare August 25, 2026 10:24
@bshek-xitaso
bshek-xitaso marked this pull request as ready for review August 25, 2026 10:24
@peinjoh

peinjoh commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Could you add some more in-code documentation when to use/not to use the environment arg?

Also, similarly to the dry-run, please document how the selection of packages works in our repos, i.e. we run on workspace and explicitly disable via cargo.toml publish=false

@bshek-xitaso
bshek-xitaso marked this pull request as draft August 25, 2026 10:57
@bshek-xitaso
bshek-xitaso force-pushed the feat/cargo-publish-workflow branch 5 times, most recently from ecd69a7 to affc3b5 Compare August 25, 2026 12:01
@bshek-xitaso
bshek-xitaso marked this pull request as ready for review August 25, 2026 12:02

@peinjoh peinjoh 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.

This is something we should discuss generally here: Do we want to allow concurrency of this job per repo? I can think of some misconfig / rerun situations were we end up with concurrently running publish of the same package, which might cause wierd results / race conditions.

We can also discuss add this later, slightly out of scope. Opinions?

Comment thread .github/workflows/cargo-publish.yml Outdated
@bshek-xitaso
bshek-xitaso marked this pull request as draft August 25, 2026 18:13
@bshek-xitaso
bshek-xitaso force-pushed the feat/cargo-publish-workflow branch 3 times, most recently from ac9ff50 to 8221d3a Compare August 26, 2026 11:01
@bshek-xitaso
bshek-xitaso marked this pull request as ready for review August 26, 2026 11:10
@bshek-xitaso

Copy link
Copy Markdown
Contributor Author

I added a repo-specific concurrency group (Code) as well as a "cargo publish --dry-run"-step for checking the publishability (Code).

About the possible permission minimization: crates-io-auth-action needs a JWT from GitHub to authenticate with crates.io (Link), and GitHub docs states that requesting this JWT requires id-token: write permission (Link). So, I think the permissions are already minimal.

@bshek-xitaso
bshek-xitaso force-pushed the feat/cargo-publish-workflow branch from 8221d3a to 93a21e4 Compare August 26, 2026 12:07
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.

3 participants