Skip to main content

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    /// Keep the one release request of the pushed base on
43    /// `rk-release/<base>`: propose the next version, write it and the
44    /// changelog, force-push as the bot, open or edit the request, and arm
45    /// it where the record's style arms. Runs in CI on a push to the
46    /// trunk or a release line; every fact comes from the record.
47    Request {
48        /// The checkout the release job runs in.
49        #[arg(long, default_value = ".")]
50        target: Utf8PathBuf,
51
52        /// Emit one JSON object on stdout instead of the human report.
53        #[arg(long)]
54        json: bool,
55    },
56
57    /// Decide whether this push releases, and build it: report
58    /// `release`, `resume`, or `skip`, and write the artifacts'
59    /// checksums, the notes, and the report into `.rk-release/`. A skip
60    /// exits 0.
61    Build {
62        /// The checkout the release job runs in.
63        #[arg(long, default_value = ".")]
64        target: Utf8PathBuf,
65
66        /// Emit one JSON object on stdout instead of the human report.
67        #[arg(long)]
68        json: bool,
69    },
70
71    /// Publish what `rk release build` reported, after the provenance:
72    /// upload every asset, then create the forge release, which creates
73    /// the tag last. A rerun keeps what already exists and adds what is missing.
74    Publish {
75        /// The checkout the release job runs in.
76        #[arg(long, default_value = ".")]
77        target: Utf8PathBuf,
78
79        /// Emit one JSON object on stdout instead of the human report.
80        #[arg(long)]
81        json: bool,
82    },
83}