refactor: Create SigningDriver and CiDriver (#197)
This also includes a new `login` command. The signing and CI logic is now using the Driver trait system along with a new experimental sigstore signing driver. New static macros have also been created to make implementation management easier for `Command` usage and `Driver` trait implementation calls. --------- Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>
This commit is contained in:
parent
3ecb0d3d93
commit
8ce83ba7ff
63 changed files with 6468 additions and 2083 deletions
44
process/drivers/github_driver/event.rs
Normal file
44
process/drivers/github_driver/event.rs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
use std::{fs, path::PathBuf};
|
||||
|
||||
use blue_build_utils::{constants::GITHUB_EVENT_PATH, get_env_var};
|
||||
use miette::{IntoDiagnostic, Result};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub(super) struct Event {
|
||||
pub repository: EventRepository,
|
||||
// pub base: Option<EventRefInfo>,
|
||||
pub head: Option<EventRefInfo>,
|
||||
|
||||
#[serde(alias = "ref")]
|
||||
pub commit_ref: Option<String>,
|
||||
}
|
||||
|
||||
impl Event {
|
||||
pub fn try_new() -> Result<Self> {
|
||||
get_env_var(GITHUB_EVENT_PATH)
|
||||
.map(PathBuf::from)
|
||||
.and_then(|event_path| {
|
||||
serde_json::from_str::<Self>(&fs::read_to_string(event_path).into_diagnostic()?)
|
||||
.into_diagnostic()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub(super) struct EventRepository {
|
||||
pub default_branch: String,
|
||||
pub owner: EventRepositoryOwner,
|
||||
pub html_url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub(super) struct EventRepositoryOwner {
|
||||
pub login: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
pub(super) struct EventRefInfo {
|
||||
#[serde(alias = "ref")]
|
||||
pub commit_ref: String,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue