requirements.integration.release
Requirements index · View definition
Requirement
A dedicated GitHub Actions workflow MUST run release-plz on pushes to
mainto create release pull requests and publish approved versions. Both jobs MUST run only when the repository owner isnikomatsakis, so forks do not attempt releases. Release pull request runs for the same ref MUST NOT run concurrently; a later run MUST wait for an earlier one rather than cancel it. Publishing MUST require a merged release-plz pull request. The release job MUST request an OIDC token for crates.io trusted publishing, and both jobs MUST use a GitHub token from a repository secret so release pull requests can trigger the normal pull request checks.
Rationale
I found no gaps. The workflow and config carry out every obligation, and one test checks each of them.
Each obligation maps to code and to the test release_workflow_runs_release_plz_with_secret_token_and_trusted_publishing in tests/repository.rs. That test carries the {test} reference to the subject.
- Dedicated workflow runs release-plz on pushes to
main:.github/workflows/release-plz.ymlis a standalone workflow. Itson:block triggers only onpushtomain, and both jobs userelease-plz/action@v0.5. The test asserts the exactonblock and thatpull_requestis absent. - Release PRs and publishing, as two jobs:
release-plz-prrunscommand: release-prandrelease-plz-releaserunscommand: release. The test checks both commands. - Both jobs run only for owner
nikomatsakis: each job hasif: ${{ github.repository_owner == 'nikomatsakis' }}. The test loops over both jobs and asserts this. - Release PR runs for the same ref don’t run concurrently, and a later run waits rather than cancels:
release-plz-prsetsconcurrency.group: release-plz-${{ github.ref }}andcancel-in-progress: false. The test asserts this block. - Publishing requires a merged release-plz PR:
release-plz.tomlsets[workspace] release_always = false. The test parses the TOML and asserts it isfalse. - The release job requests an OIDC token for trusted publishing:
release-plz-releasehaspermissions: id-token: write. The test asserts it. - Both jobs use a GitHub token from a repository secret: both jobs set
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}on the release-plz step. The shared checkout step also usestoken: ${{ secrets.RELEASE_PLZ_TOKEN }}. The test asserts the env token for both jobs and the checkout token for the release job.release-plz-prreuses the same checkout step through the*checkoutYAML alias, and the test asserts that alias is present.
I found no unspecified extra behavior beyond ordinary job permissions and setup steps.
Inputs
Implementation
Input 2: outline .github/workflows/release-plz.yml pair[on]
- File:
.github/workflows/release-plz.yml - Selector:
pair[on] - Kind:
pair .github/workflows/release-plz.yml:3–7
# {impl}`requirements.integration.release`
on:
push:
branches:
- main
Input 3: outline .github/workflows/release-plz.yml pair[jobs]/pair[release-plz-release]
- File:
.github/workflows/release-plz.yml - Selector:
pair[jobs]/pair[release-plz-release] - Kind:
pair .github/workflows/release-plz.yml:10–36
# {impl}`requirements.integration.release`
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'nikomatsakis' }}
permissions:
contents: write
id-token: write
steps:
- &checkout
name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: true
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- &install-rust
name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
# {impl}`requirements.integration.release`
Input 4: outline .github/workflows/release-plz.yml pair[jobs]/pair[release-plz-pr]
- File:
.github/workflows/release-plz.yml - Selector:
pair[jobs]/pair[release-plz-pr] - Kind:
pair .github/workflows/release-plz.yml:36–55
# {impl}`requirements.integration.release`
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'nikomatsakis' }}
permissions:
pull-requests: write
contents: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- *checkout
- *install-rust
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
Input 5: outline release-plz.toml table[workspace]/pair[release_always]
- File:
release-plz.toml - Selector:
table[workspace]/pair[release_always] - Kind:
pair release-plz.toml:2–3
# {impl}`requirements.integration.release`
release_always = false
Input 7: outline .github/workflows/release-plz.yml pair[jobs]
- File:
.github/workflows/release-plz.yml - Selector:
pair[jobs] - Kind:
pair .github/workflows/release-plz.yml:9–55
jobs:
# {impl}`requirements.integration.release`
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'nikomatsakis' }}
permissions:
contents: write
id-token: write
steps:
- &checkout
name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: true
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
- &install-rust
name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
# {impl}`requirements.integration.release`
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'nikomatsakis' }}
permissions:
pull-requests: write
contents: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- *checkout
- *install-rust
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
Input 9: outline release-plz.toml table[workspace]
- File:
release-plz.toml - Selector:
table[workspace] - Kind:
table release-plz.toml:1–3
[workspace]
# {impl}`requirements.integration.release`
release_always = false
Tests
Input 6: outline tests/repository.rs fn[release_workflow_runs_release_plz_with_secret_token_and_trusted_publishing]
- File:
tests/repository.rs - Selector:
fn[release_workflow_runs_release_plz_with_secret_token_and_trusted_publishing] - Kind:
fn tests/repository.rs:382–424
// {test}`requirements.integration.release`
#[test]
fn release_workflow_runs_release_plz_with_secret_token_and_trusted_publishing() {
let workflow = repository_file(".github/workflows/release-plz.yml");
assert!(
workflow.contains("\non:\n push:\n branches:\n - main\n\n"),
"{workflow}"
);
assert!(!workflow.contains("pull_request"), "{workflow}");
let release = workflow_job(&workflow, "release-plz-release");
assert!(release.contains("id-token: write"), "{release}");
assert!(release.contains("command: release\n"), "{release}");
assert!(
release.contains("GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}"),
"{release}"
);
let pr = workflow_job(&workflow, "release-plz-pr");
assert!(pr.contains("command: release-pr\n"), "{pr}");
assert!(
pr.contains("GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}"),
"{pr}"
);
assert!(pr.contains("- *checkout\n"), "{pr}");
for job in [&release, &pr] {
assert!(
job.contains("if: ${{ github.repository_owner == 'nikomatsakis' }}"),
"{job}"
);
}
assert!(
pr.contains("concurrency:\n group: release-plz-${{ github.ref }}\n cancel-in-progress: false\n"),
"{pr}"
);
assert!(
release.contains("token: ${{ secrets.RELEASE_PLZ_TOKEN }}"),
"the shared checkout step uses the secret token too: {release}"
);
let config = repository_toml("release-plz.toml");
assert_eq!(config["workspace"]["release_always"].as_bool(), Some(false));
}
Other sources
Input 1: requirements selection requirements.integration.release
requirements.integration.release:md/requirements/integration.md:89–92
:::{req} release
A dedicated GitHub Actions workflow MUST run release-plz on pushes to `main` to create release pull requests and publish approved versions. Both jobs MUST run only when the repository owner is `nikomatsakis`, so forks do not attempt releases. Release pull request runs for the same ref MUST NOT run concurrently; a later run MUST wait for an earlier one rather than cancel it. Publishing MUST require a merged release-plz pull request. The release job MUST request an OIDC token for crates.io trusted publishing, and both jobs MUST use a GitHub token from a repository secret so release pull requests can trigger the normal pull request checks.
:::
Input 8: outline .github/workflows/release-plz.yml pair[name]
- File:
.github/workflows/release-plz.yml - Selector:
pair[name] - Kind:
pair .github/workflows/release-plz.yml:1–1
name: Release-plz