mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-10 03:41:42 +01:00
with releaser
This commit is contained in:
parent
df7a253bc8
commit
e16f5037dc
6
.github/workflows/create-release.yml
vendored
6
.github/workflows/create-release.yml
vendored
@ -16,6 +16,10 @@ jobs:
|
||||
changelog: CHANGELOG.md
|
||||
# (Optional) Create a draft release.
|
||||
# [default value: false]
|
||||
draft: true
|
||||
draft: false
|
||||
# (Required) GitHub token for creating GitHub Releases.
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Update rust toolchain
|
||||
run: rustup update stable && rustup default stable
|
||||
- name: Run dagger [RELEASE]
|
||||
run: cargo run -p ci -- release --version="${{github.ref_name}}"
|
||||
|
@ -8,6 +8,10 @@ fn main() -> eyre::Result<()> {
|
||||
let matches = clap::Command::new("ci")
|
||||
.subcommand_required(true)
|
||||
.subcommand(clap::Command::new("pr"))
|
||||
.subcommand(
|
||||
clap::Command::new("release")
|
||||
.arg(clap::Arg::new("version").long("version").required(true)),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let client = dagger_sdk::client::connect()?;
|
||||
@ -16,6 +20,7 @@ fn main() -> eyre::Result<()> {
|
||||
|
||||
match matches.subcommand() {
|
||||
Some(("pr", _)) => return validate_pr(client, base),
|
||||
Some(("release", subm)) => return release(client, base, subm),
|
||||
Some(_) => {
|
||||
panic!("invalid subcommand selected!")
|
||||
}
|
||||
@ -25,6 +30,63 @@ fn main() -> eyre::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
fn release(
|
||||
client: Arc<Query>,
|
||||
base: Container,
|
||||
subm: &clap::ArgMatches,
|
||||
) -> Result<(), color_eyre::Report> {
|
||||
let version = subm.get_one::<String>("version").unwrap();
|
||||
|
||||
let container = base
|
||||
.with_exec(
|
||||
vec!["cargo".into(), "install".into(), "cargo-release".into()],
|
||||
None,
|
||||
)
|
||||
.with_exec(
|
||||
vec![
|
||||
"cargo".into(),
|
||||
"release".into(),
|
||||
"version".into(),
|
||||
"--workspace".into(),
|
||||
"--execute".into(),
|
||||
"--no-confirm".into(),
|
||||
version.clone(),
|
||||
],
|
||||
None,
|
||||
)
|
||||
.with_exec(
|
||||
vec![
|
||||
"cargo".into(),
|
||||
"release".into(),
|
||||
"replace".into(),
|
||||
"--workspace".into(),
|
||||
"--execute".into(),
|
||||
"--no-confirm".into(),
|
||||
],
|
||||
None,
|
||||
)
|
||||
.with_exec(
|
||||
vec![
|
||||
"cargo".into(),
|
||||
"release".into(),
|
||||
"publish".into(),
|
||||
"--workspace".into(),
|
||||
"--execute".into(),
|
||||
"--no-verify".into(),
|
||||
"--no-confirm".into(),
|
||||
],
|
||||
None,
|
||||
);
|
||||
let exit = container.exit_code();
|
||||
if exit != 0 {
|
||||
eyre::bail!("container failed with non-zero exit code");
|
||||
}
|
||||
|
||||
println!("validating pr succeeded!");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_dependencies(client: Arc<Query>) -> Container {
|
||||
let cargo_dir = client.host().directory(
|
||||
".".into(),
|
||||
|
Loading…
Reference in New Issue
Block a user