oxyde_cloud_cli/commands/
deploy.rs

1use anyhow::{Context, Result};
2use cargo_leptos::config::Opts;
3use cliclack::{intro, log::remark, outro};
4use oxyde_cloud_common::config::CloudConfig;
5use std::path::PathBuf;
6
7#[cfg(feature = "with-deploy-test")]
8pub async fn deploy(config: PathBuf) -> Result<()> {
9    intro("Deploy to Oxyde Cloud").context("Failed to show deploy intro")?;
10
11    // Load and validate config
12    let cloud_config = CloudConfig::load(&config)
13        .await
14        .context("Failed to load config file")?;
15
16    // Use default cargo-leptos options if none provided
17    let opts = Opts {
18        release: true,
19        ..Default::default()
20    };
21
22    remark("Building and deploying..").context("Failed to show API key instructions")?;
23
24    oxyde_cloud_deploy::deploy_with_config_file(&config, opts)
25        .await
26        .context("Failed to deploy")?;
27    outro(format!(
28        "Your app '{}' has been deployed",
29        cloud_config.app.slug,
30    ))
31    .context("Failed to show deployment success message")?;
32
33    Ok(())
34}