generated from PlexSheep/rs-base
important changes
This commit is contained in:
parent
acc5381dd1
commit
77f0aabdfc
|
@ -52,6 +52,9 @@ pub enum Commands {
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
// find a way to make this a global option but only usable with specific subcommands
|
// find a way to make this a global option but only usable with specific subcommands
|
||||||
|
//
|
||||||
|
// TODO:
|
||||||
|
// integrate a CHANGELOG.md file
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
message: Option<Vec<String>>,
|
message: Option<Vec<String>>,
|
||||||
},
|
},
|
||||||
|
@ -60,6 +63,7 @@ pub enum Commands {
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
message: Option<Vec<String>>,
|
message: Option<Vec<String>>,
|
||||||
},
|
},
|
||||||
|
Version {},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Display for Commands {
|
impl Display for Commands {
|
||||||
|
@ -71,6 +75,7 @@ impl Display for Commands {
|
||||||
Self::Changelog { .. } => "Changelog",
|
Self::Changelog { .. } => "Changelog",
|
||||||
Self::Release { .. } => "Release",
|
Self::Release { .. } => "Release",
|
||||||
Self::Publish { .. } => "Publish",
|
Self::Publish { .. } => "Publish",
|
||||||
|
Self::Version { .. } => "Version",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ use url::Url;
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
|
|
||||||
pub mod cli;
|
pub mod cli;
|
||||||
|
pub mod packages;
|
||||||
|
use packages::*;
|
||||||
use cli::Cli;
|
use cli::Cli;
|
||||||
|
|
||||||
pub trait YamlConfigSection: Debug + Clone + for<'a> Deserialize<'a> {
|
pub trait YamlConfigSection: Debug + Clone + for<'a> Deserialize<'a> {
|
||||||
|
@ -101,6 +103,8 @@ pub enum ApiType {
|
||||||
Gitlab,
|
Gitlab,
|
||||||
#[serde(alias = "github", alias = "GitHub")]
|
#[serde(alias = "github", alias = "GitHub")]
|
||||||
Github,
|
Github,
|
||||||
|
#[serde(alias = "forgejo")]
|
||||||
|
Forgejo,
|
||||||
}
|
}
|
||||||
impl YamlConfigSection for ApiType {
|
impl YamlConfigSection for ApiType {
|
||||||
fn check(&self) -> Result<()> {
|
fn check(&self) -> Result<()> {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
pub enum PackageType {
|
||||||
|
Cargo
|
||||||
|
}
|
|
@ -26,6 +26,12 @@ async fn main() -> Result<()> {
|
||||||
Commands::Publish { .. } => {
|
Commands::Publish { .. } => {
|
||||||
publish(&cfg).await?;
|
publish(&cfg).await?;
|
||||||
}
|
}
|
||||||
|
Commands::Version {} => {
|
||||||
|
// TODO: version bump
|
||||||
|
// TODO: version select interactive
|
||||||
|
// TODO: version select automated
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,26 @@ use crate::{config::Config, error::*, serverapi::ApiCollection};
|
||||||
|
|
||||||
pub async fn release(cfg: &Config, apis: &mut ApiCollection) -> Result<()> {
|
pub async fn release(cfg: &Config, apis: &mut ApiCollection) -> Result<()> {
|
||||||
// TODO: git tag
|
// TODO: git tag
|
||||||
// TODO: version bump
|
|
||||||
// TODO: version select interactive
|
|
||||||
// TODO: version select automated
|
|
||||||
// TODO: push to each server
|
// TODO: push to each server
|
||||||
|
|
||||||
// TODO: release to each server
|
// TODO: release to each server
|
||||||
|
tag(cfg).await?;
|
||||||
|
for api in apis.iter_mut() {
|
||||||
|
api.push_release().await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
for api in apis.iter_mut() {
|
||||||
|
api.push_release().await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: check that the release is made
|
||||||
|
// TODO: generate artifacts
|
||||||
|
// TODO: upload artifacts
|
||||||
|
// TODO: upload artifact signatures
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn tag(cfg: &Config) -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
use async_trait::async_trait;
|
||||||
|
|
||||||
|
use super::ServerApi;
|
||||||
|
use crate::{
|
||||||
|
config::{packages::PackageType, ApiType, Config},
|
||||||
|
error::*,
|
||||||
|
};
|
||||||
|
pub struct Forgejo;
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl ServerApi for Forgejo {
|
||||||
|
async fn init(&mut self, cfg: &Config) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
async fn push_release(&mut self) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Forgejo {
|
||||||
|
pub async fn build(cfg: &Config) -> Result<Self> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,7 +2,7 @@ use async_trait::async_trait;
|
||||||
|
|
||||||
use super::ServerApi;
|
use super::ServerApi;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{ApiType, Config},
|
config::{packages::PackageType, ApiType, Config},
|
||||||
error::*,
|
error::*,
|
||||||
};
|
};
|
||||||
pub struct Gitea;
|
pub struct Gitea;
|
||||||
|
@ -15,6 +15,9 @@ impl ServerApi for Gitea {
|
||||||
async fn push_release(&mut self) -> Result<()> {
|
async fn push_release(&mut self) -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Gitea {
|
impl Gitea {
|
||||||
|
|
|
@ -2,7 +2,7 @@ use async_trait::async_trait;
|
||||||
|
|
||||||
use super::ServerApi;
|
use super::ServerApi;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{ApiType, Config},
|
config::{packages::PackageType, ApiType, Config},
|
||||||
error::*,
|
error::*,
|
||||||
};
|
};
|
||||||
pub struct Github;
|
pub struct Github;
|
||||||
|
@ -15,6 +15,9 @@ impl ServerApi for Github {
|
||||||
async fn push_release(&mut self) -> Result<()> {
|
async fn push_release(&mut self) -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Github {
|
impl Github {
|
||||||
|
|
|
@ -2,7 +2,7 @@ use async_trait::async_trait;
|
||||||
|
|
||||||
use super::ServerApi;
|
use super::ServerApi;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{ApiType, Config},
|
config::{packages::PackageType, ApiType, Config},
|
||||||
error::*,
|
error::*,
|
||||||
};
|
};
|
||||||
pub struct Gitlab;
|
pub struct Gitlab;
|
||||||
|
@ -15,6 +15,9 @@ impl ServerApi for Gitlab {
|
||||||
async fn push_release(&mut self) -> Result<()> {
|
async fn push_release(&mut self) -> Result<()> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Gitlab {
|
impl Gitlab {
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{ApiType, Config},
|
config::{packages::PackageType, ApiType, Config},
|
||||||
error::*,
|
error::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub mod forgejo;
|
||||||
pub mod gitea;
|
pub mod gitea;
|
||||||
pub mod github;
|
pub mod github;
|
||||||
pub mod gitlab;
|
pub mod gitlab;
|
||||||
|
use forgejo::*;
|
||||||
use gitea::*;
|
use gitea::*;
|
||||||
use github::*;
|
use github::*;
|
||||||
use gitlab::*;
|
use gitlab::*;
|
||||||
|
@ -21,6 +23,8 @@ pub type ApiCollection = Vec<Box<dyn ServerApi>>;
|
||||||
pub trait ServerApi {
|
pub trait ServerApi {
|
||||||
async fn init(&mut self, cfg: &Config) -> Result<()>;
|
async fn init(&mut self, cfg: &Config) -> Result<()>;
|
||||||
async fn push_release(&mut self) -> Result<()>;
|
async fn push_release(&mut self) -> Result<()>;
|
||||||
|
async fn push_release_artifact(&mut self) -> Result<()>;
|
||||||
|
async fn push_pkg(&mut self, pkg_type: PackageType) -> Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn init_servers(cfg: &Config) -> Result<ApiCollection> {
|
pub async fn init_servers(cfg: &Config) -> Result<ApiCollection> {
|
||||||
|
@ -36,6 +40,9 @@ pub async fn init_servers(cfg: &Config) -> Result<ApiCollection> {
|
||||||
ApiType::Github => {
|
ApiType::Github => {
|
||||||
collection.push(Box::new(Github::build(cfg).await?));
|
collection.push(Box::new(Github::build(cfg).await?));
|
||||||
}
|
}
|
||||||
|
ApiType::Forgejo => {
|
||||||
|
collection.push(Box::new(Forgejo::build(cfg).await?));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(collection)
|
Ok(collection)
|
||||||
|
|
Loading…
Reference in New Issue