release_kit/cli/release.rs
1//! Arguments for `rk release`.
2
3use camino::Utf8PathBuf;
4use clap::{Args, Subcommand};
5
6/// Report where the target's release stands, and run the release
7/// engine's actions.
8#[derive(Debug, Args)]
9pub struct ReleaseArgs {
10 /// What to report.
11 #[command(subcommand)]
12 pub action: ReleaseAction,
13}
14
15/// The release verbs.
16#[derive(Debug, Subcommand)]
17pub enum ReleaseAction {
18 /// Report the release style, the release request, the last release,
19 /// each release line, and every symptom a stuck release shows. The
20 /// record fields read offline; a forge field reads unknown where this
21 /// runtime cannot read the forge.
22 Status {
23 /// The repository to report on.
24 #[arg(long, default_value = ".")]
25 target: Utf8PathBuf,
26
27 /// Wait until the publish run and the artifact run on this commit
28 /// conclude, selected by the commit and never by recency, then
29 /// report the release they made.
30 #[arg(long, value_name = "SHA")]
31 wait: Option<String>,
32
33 /// How long `--wait` waits before it gives up, in seconds.
34 #[arg(long, default_value_t = 3600, requires = "wait")]
35 timeout: u64,
36
37 /// Emit one JSON object on stdout instead of the human report.
38 #[arg(long)]
39 json: bool,
40 },
41
42 /// Merge the trunk's release request on the operator's order. Without
43 /// `--apply`, read the one open release request against the trunk, the
44 /// trunk tip, its head, and the required check for that head, and write
45 /// nothing. With `--apply`, dispatch the landed merge job with exactly
46 /// those values, which runs as the release bot, proves each one again,
47 /// and merges with the head pinned, then wait for that one run. A
48 /// release line keeps the merge by a person.
49 Merge {
50 /// The landed target whose trunk release request merges.
51 #[arg(long, default_value = ".")]
52 target: Utf8PathBuf,
53
54 /// Dispatch the merge job and wait for it; without it, preview.
55 #[arg(long)]
56 apply: bool,
57
58 /// How long `--apply` waits for the merge run, in seconds.
59 #[arg(long, default_value_t = 1800, requires = "apply")]
60 timeout: u64,
61
62 /// Emit one JSON object on stdout instead of the human report.
63 #[arg(long)]
64 json: bool,
65 },
66
67 /// Keep the one release request of the pushed base on
68 /// `rk-release/<base>`: propose the next version, write it and the
69 /// changelog, force-push as the bot, and open or edit the request,
70 /// which it never arms: a release waits for the operator's order. Runs
71 /// in CI on a push to the trunk or a release line; every fact comes
72 /// from the record.
73 Request {
74 /// The checkout the release job runs in.
75 #[arg(long, default_value = ".")]
76 target: Utf8PathBuf,
77
78 /// Emit one JSON object on stdout instead of the human report.
79 #[arg(long)]
80 json: bool,
81 },
82
83 /// Decide whether this push releases, and build it: report
84 /// `release`, `resume`, or `skip`, and write the artifacts'
85 /// checksums, the notes, and the report into `.rk-release/`. A skip
86 /// exits 0.
87 Build {
88 /// The checkout the release job runs in.
89 #[arg(long, default_value = ".")]
90 target: Utf8PathBuf,
91
92 /// Print the files the package holds at `HEAD`, one path per line,
93 /// as `cargo package --list` does, and write nothing: no build
94 /// output, no report, and no forge read.
95 #[arg(long)]
96 list: bool,
97
98 /// Emit one JSON object on stdout instead of the human report.
99 #[arg(long)]
100 json: bool,
101 },
102
103 /// Answer whether the change since the last release is worth a
104 /// release: a file the package ships changed, and a commit that touched
105 /// the packed files is a feat, fix, or perf commit or marks a breaking
106 /// change. Writes nothing and reads no forge; the last release is the
107 /// release tag git holds. A rust target's request job runs it before
108 /// release-plz.
109 Eligible {
110 /// The checkout to judge.
111 #[arg(long, default_value = ".")]
112 target: Utf8PathBuf,
113
114 /// Emit one JSON object on stdout instead of the human report.
115 #[arg(long)]
116 json: bool,
117 },
118
119 /// Publish what `rk release build` reported, after the provenance:
120 /// upload every asset, then create the forge release, which creates
121 /// the tag last. A rerun keeps what already exists and adds what is missing.
122 Publish {
123 /// The checkout the release job runs in.
124 #[arg(long, default_value = ".")]
125 target: Utf8PathBuf,
126
127 /// Emit one JSON object on stdout instead of the human report.
128 #[arg(long)]
129 json: bool,
130 },
131}