Skip to content

ci: Add reusable workspace release workflow#11

Merged
huitseeker merged 10 commits into
mainfrom
ci/reusable-workspace-release
Apr 10, 2026
Merged

ci: Add reusable workspace release workflow#11
huitseeker merged 10 commits into
mainfrom
ci/reusable-workspace-release

Conversation

@huitseeker
Copy link
Copy Markdown
Collaborator

@huitseeker huitseeker commented Apr 8, 2026

This adds a shared workflow for Rust workspace releases.

Callers must pass the path to their MSRV check script. The workflow runs MSRV checks, semver checks, and then the release flow.

Dry-run treats semver regressions as failures. Publish reports them as warnings but still publishes.

Usage PR at 0xMiden/crypto#938

Pinned the shared workspace release workflow’s third-party actions to commit SHAs and disabled checkout credential persistence where no push access is needed.

@huitseeker huitseeker force-pushed the ci/reusable-workspace-release branch from 6e1806b to 22442a6 Compare April 8, 2026 11:01
fetch-depth: 1
token: ${{ env.SHARED_WORKFLOW_REPOSITORY_TOKEN_INPUT != '' && env.SHARED_WORKFLOW_REPOSITORY_TOKEN_INPUT || github.token }}

- name: Verify checked out commit matches target ref HEAD
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

note to self: the job in the protocol repo uses slightly different inputs, though the underlying logic seems the same

id: resolve_cargo_msrv_toolchain
shell: bash
env:
CARGO_MSRV_TOOLCHAIN_INPUT: ${{ inputs.cargo_msrv_toolchain }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

shouldn't this default to the latest toolchain (see 0xMiden/protocol#2729)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'm relying on the invariant that the repo should be using the default toolchain already.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

right, so in that case we shouldn't need these extra couple of steps to figure out the MSVR toolchain and to install it - or am I missing something?

Copy link
Copy Markdown
Collaborator Author

@huitseeker huitseeker Apr 8, 2026

Choose a reason for hiding this comment

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

Let me rephrase: this is an optional parameter, that's intended to not be provided in most case, and in this not-provided (default) case resolves to the repo's toolchain file.

This is just an override: in the case the MSRV check requires something else, they have access to a possible override. This is used in the consumer PR opened against crypto, linked in the PR description.

Comment thread .github/workflows/workspace-release.yml Outdated
shell: bash
run: cargo publish --workspace

workspace-release-with-environment:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I follow why there are two jobs "with" and "without" the environment. It seems that we're always going to default to the one with environment if we want to publish?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, publish should always go through the job with the environment.

The split is there because environment is a job-level key, and with jobs.<id>.uses the caller cannot set it conditionally on the reusable job. So this keeps dry-run env-free, while publish can still attach the protected environment.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So this keeps dry-run env-free

Would bad things happen if dry-run gets an environment as well?

Copy link
Copy Markdown
Collaborator Author

@huitseeker huitseeker Apr 8, 2026

Choose a reason for hiding this comment

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

Privilege escalation, if any consumer repo of this reusable workflow decides to use protection rules to manage the publication environment:
https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
(or, of course, prevention from using protection rules in this privileged environment)

Basically, publish needs a secret which dry-run doesn't, and the best security practice is to tie this secret to that environment. (zizmor has a dedicated warning: https://docs.zizmor.sh/audits/#secrets-outside-env)

Comment thread .github/workflows/workspace-release.yml Outdated
…ns to commit SHAs and disabled checkout credential persistence where no push access is needed.
0xMiden/.github is public, so callers do not need to pass a secret to check out the shared workflow repository.
@huitseeker huitseeker merged commit d34ae3c into main Apr 10, 2026
2 checks passed
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