Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(releasing): Fix globbing of release artifacts for GitHub #17114

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vdev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ confy = "0.5.1"
directories = "5.0.0"
# remove this when stabilized https://doc.rust-lang.org/stable/std/path/fn.absolute.html
dunce = "1.0.3"
glob = { version = "0.3.1", default-features = false }
hashlink = { version = "0.8.1", features = ["serde_impl"] }
hex = "0.4.3"
indicatif = { version = "0.17.3", features = ["improved_unicode"] }
Expand Down
40 changes: 27 additions & 13 deletions vdev/src/commands/release/github.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::app::CommandExt as _;
use crate::util;
use anyhow::{Ok, Result};
use anyhow::{anyhow, Ok, Result};
use glob::glob;
use std::process::Command;

/// Uploads target/artifacts to GitHub releases
Expand All @@ -10,21 +11,34 @@ pub struct Cli {}

impl Cli {
pub fn exec(self) -> Result<()> {
let artifacts = glob("target/artifacts/*")
.expect("failed to read glob pattern")
.collect::<Result<Vec<_>, _>>()
.map_err(|e| anyhow!("failed to read path: {}", e))?
.into_iter()
.map(|p| p.into_os_string().into_string())
.collect::<Result<Vec<_>, _>>()
.map_err(|e| anyhow!("failed to turn path into string: {:?}", e))?;

let version = util::get_version()?;
let mut command = Command::new("gh");
command.in_repo();
command.args([
"release",
"--repo",
"vectordotdev/vector",
"create",
&format!("v{version}"),
"--title",
&format!("v{version}"),
"--notes",
&format!("[View release notes](https://vector.dev/releases/{version})"),
"target/artifacts/*",
]);
command.args(
[
"release",
"--repo",
"vectordotdev/vector",
"create",
&format!("v{version}"),
"--title",
&format!("v{version}"),
"--notes",
&format!("[View release notes](https://vector.dev/releases/{version})"),
]
.map(String::from)
.into_iter()
.chain(artifacts),
);
command.check_run()?;
Ok(())
}
Expand Down