ci: Added CI/CD and release pipelines (#45)

This commit is contained in:
Vlad Frolov
2026-02-12 12:25:36 +01:00
committed by GitHub
parent 115b7f38fe
commit 09198c68ab
25 changed files with 886 additions and 161 deletions
+3 -1
View File
@@ -71,7 +71,9 @@ pub async fn run_config_command(cmd: ConfigCommand) -> anyhow::Result<()> {
/// Bootstrap a DB connection for config commands.
async fn connect_store() -> anyhow::Result<crate::history::Store> {
let config = crate::config::Config::from_env().await.map_err(|e| anyhow::anyhow!("{}", e))?;
let config = crate::config::Config::from_env()
.await
.map_err(|e| anyhow::anyhow!("{}", e))?;
let store = crate::history::Store::new(&config.database).await?;
store.run_migrations().await?;
Ok(store)
+9 -5
View File
@@ -52,7 +52,10 @@ fn run_list(store: &PairingStore, channel: &str, json: bool) -> Result<(), Strin
let requests = store.list_pending(channel).map_err(|e| e.to_string())?;
if json {
println!("{}", serde_json::to_string_pretty(&requests).map_err(|e| e.to_string())?);
println!(
"{}",
serde_json::to_string_pretty(&requests).map_err(|e| e.to_string())?
);
return Ok(());
}
@@ -69,9 +72,7 @@ fn run_list(store: &PairingStore, channel: &str, json: bool) -> Result<(), Strin
.and_then(|m| m.as_object())
.map(|o| {
o.iter()
.filter_map(|(k, v)| {
v.as_str().map(|s| format!("{}={}", k, s))
})
.filter_map(|(k, v)| v.as_str().map(|s| format!("{}={}", k, s)))
.collect::<Vec<_>>()
.join(", ")
})
@@ -88,7 +89,10 @@ fn run_approve(store: &PairingStore, channel: &str, code: &str) -> Result<(), St
println!("Approved {} sender {}.", channel, entry.id);
Ok(())
}
Ok(None) => Err(format!("No pending pairing request found for code: {}", code)),
Ok(None) => Err(format!(
"No pending pairing request found for code: {}",
code
)),
Err(crate::pairing::PairingStoreError::ApproveRateLimited) => Err(
"Too many failed approve attempts. Wait a few minutes before trying again.".to_string(),
),