Skip to content

Commit d4f89af

Browse files
committed
feat: skip password prompt on the build command if CI is set fixes #6089
1 parent 8fb1df8 commit d4f89af

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Skip the password prompt on the build command when `TAURI_KEY_PASSWORD` environment variable is empty and the `--ci` argument is provided or the `CI` environment variable is set.

examples/api/src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/cli/src/build.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,15 @@ pub struct Options {
5454
pub config: Option<String>,
5555
/// Command line arguments passed to the runner
5656
pub args: Vec<String>,
57+
/// Skip prompting for values
58+
#[clap(long)]
59+
ci: bool,
5760
}
5861

5962
pub fn command(mut options: Options) -> Result<()> {
63+
options.ci = options.ci || std::env::var("CI").is_ok();
64+
let ci = options.ci;
65+
6066
let (merge_config, merge_config_path) = if let Some(config) = &options.config {
6167
if config.starts_with('{') {
6268
(Some(config.to_string()), None)
@@ -271,7 +277,9 @@ pub fn command(mut options: Options) -> Result<()> {
271277
// If updater is active and we bundled it
272278
if config_.tauri.updater.active && !updater_bundles.is_empty() {
273279
// if no password provided we use an empty string
274-
let password = var_os("TAURI_KEY_PASSWORD").map(|v| v.to_str().unwrap().to_string());
280+
let password = var_os("TAURI_KEY_PASSWORD")
281+
.map(|v| v.to_str().unwrap().to_string())
282+
.or_else(|| if ci { Some("".into()) } else { None });
275283
// get the private key
276284
let secret_key = if let Some(mut private_key) =
277285
var_os("TAURI_PRIVATE_KEY").map(|v| v.to_str().unwrap().to_string())

tooling/cli/src/signer/generate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct Options {
2222
#[clap(short, long)]
2323
force: bool,
2424
/// Skip prompting for values
25-
#[clap(short, long)]
25+
#[clap(long)]
2626
ci: bool,
2727
}
2828

0 commit comments

Comments
 (0)