Skip to content

Commit deaadb7

Browse files
committed
rust: add dry run mode to upload-release-distribution
1 parent 749e247 commit deaadb7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/github.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ pub async fn command_upload_release_distributions(args: &ArgMatches) -> Result<(
189189
.value_of("organization")
190190
.expect("organization should be specified");
191191
let repo = args.value_of("repo").expect("repo should be specified");
192+
let dry_run = args.is_present("dry_run");
192193

193194
let mut filenames = std::fs::read_dir(&dist_dir)?
194195
.into_iter()
@@ -287,6 +288,10 @@ pub async fn command_upload_release_distributions(args: &ArgMatches) -> Result<(
287288
.header("Content-Type", "application/x-tar")
288289
.body(file_data);
289290

291+
if dry_run {
292+
continue;
293+
}
294+
290295
let response = client.execute(request).await?;
291296

292297
if !response.status().is_success() {

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,11 @@ fn main_impl() -> Result<()> {
104104
.takes_value(true)
105105
.help("Date/time tag associated with builds"),
106106
)
107+
.arg(
108+
Arg::new("dry_run")
109+
.short('n')
110+
.help("Dry run mode; do not actually upload"),
111+
)
107112
.arg(
108113
Arg::new("tag")
109114
.long("--tag")

0 commit comments

Comments
 (0)