feat(ci): with internal please action
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
37054fa012
commit
8c3b5e660f
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -183,6 +183,7 @@ dependencies = [
|
|||||||
"async-scoped",
|
"async-scoped",
|
||||||
"clap",
|
"clap",
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
|
"dagger-cuddle-please",
|
||||||
"dagger-sdk",
|
"dagger-sdk",
|
||||||
"dotenv",
|
"dotenv",
|
||||||
"eyre",
|
"eyre",
|
||||||
|
@ -6,6 +6,8 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
dagger-cuddle-please.workspace = true
|
||||||
|
|
||||||
dagger-sdk = "*"
|
dagger-sdk = "*"
|
||||||
eyre = "*"
|
eyre = "*"
|
||||||
color-eyre = "*"
|
color-eyre = "*"
|
||||||
|
@ -119,67 +119,24 @@ async fn main() -> eyre::Result<()> {
|
|||||||
mod please_release {
|
mod please_release {
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use dagger_cuddle_please::{models::CuddlePleaseSrcArgs, DaggerCuddlePleaseAction};
|
||||||
|
|
||||||
use crate::GlobalArgs;
|
use crate::GlobalArgs;
|
||||||
|
|
||||||
pub async fn run_release_please(
|
pub async fn run_release_please(
|
||||||
client: Arc<dagger_sdk::Query>,
|
client: Arc<dagger_sdk::Query>,
|
||||||
args: &GlobalArgs,
|
args: &GlobalArgs,
|
||||||
) -> eyre::Result<()> {
|
) -> eyre::Result<()> {
|
||||||
let build_image = client
|
DaggerCuddlePleaseAction::dagger(client)
|
||||||
.container()
|
.execute_src(&CuddlePleaseSrcArgs {
|
||||||
.from("kasperhermansen/cuddle-please:main-1691504183");
|
cuddle_image: "kasperhermansen/cuddle-please:main-1691504183".into(),
|
||||||
|
server: dagger_cuddle_please::models::SrcServer::Gitea {
|
||||||
let src = client
|
token: std::env::var("CUDDLE_PLEASE_TOKEN")
|
||||||
.git_opts(
|
.expect("CUDDLE_PLEASE_TOKEN to be present"),
|
||||||
"https://git.front.kjuulh.io/kjuulh/dagger-components",
|
|
||||||
dagger_sdk::QueryGitOpts {
|
|
||||||
experimental_service_host: None,
|
|
||||||
keep_git_dir: Some(true),
|
|
||||||
},
|
},
|
||||||
)
|
log_level: Some(dagger_cuddle_please::models::LogLevel::Debug),
|
||||||
.branch("main")
|
})
|
||||||
.tree();
|
.await?;
|
||||||
|
|
||||||
let res = build_image
|
|
||||||
.with_secret_variable(
|
|
||||||
"CUDDLE_PLEASE_TOKEN",
|
|
||||||
client
|
|
||||||
.set_secret("CUDDLE_PLEASE_TOKEN", std::env::var("CUDDLE_PLEASE_TOKEN")?)
|
|
||||||
.id()
|
|
||||||
.await?,
|
|
||||||
)
|
|
||||||
.with_workdir("/mnt/app")
|
|
||||||
.with_directory(".", src.id().await?)
|
|
||||||
.with_exec(vec![
|
|
||||||
"git",
|
|
||||||
"remote",
|
|
||||||
"set-url",
|
|
||||||
"origin",
|
|
||||||
&format!(
|
|
||||||
"https://git:{}@git.front.kjuulh.io/kjuulh/dagger-components.git",
|
|
||||||
std::env::var("CUDDLE_PLEASE_TOKEN")?
|
|
||||||
),
|
|
||||||
])
|
|
||||||
.with_exec(vec![
|
|
||||||
"cuddle-please",
|
|
||||||
"release",
|
|
||||||
"--engine=gitea",
|
|
||||||
"--owner=kjuulh",
|
|
||||||
"--repo=dagger-components",
|
|
||||||
"--branch=main",
|
|
||||||
"--api-url=https://git.front.kjuulh.io",
|
|
||||||
"--log-level=debug",
|
|
||||||
]);
|
|
||||||
|
|
||||||
let exit_code = res.exit_code().await?;
|
|
||||||
if exit_code != 0 {
|
|
||||||
eyre::bail!("failed to run cuddle-please");
|
|
||||||
}
|
|
||||||
|
|
||||||
let please_out = res.stdout().await?;
|
|
||||||
println!("{please_out}");
|
|
||||||
let please_out = res.stderr().await?;
|
|
||||||
println!("{please_out}");
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user