build: only sign if a gpg key able to sign is present
Some checks failed
CI / build (push) Failing after 1m50s
Some checks failed
CI / build (push) Failing after 1m50s
This commit is contained in:
@@ -114,7 +114,8 @@ fn increment_suffix(version: &str, suffix: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a changelog file first entry header, to obtain (package, version, series)
|
||||
/// Parse a changelog file first entry header
|
||||
/// Returns (package, version, series) tuple from the last modification entry
|
||||
pub fn parse_changelog_header(
|
||||
path: &Path,
|
||||
) -> Result<(String, String, String), Box<dyn std::error::Error>> {
|
||||
@@ -135,6 +136,33 @@ pub fn parse_changelog_header(
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a changelog file footer to extract maintainer information
|
||||
/// Returns (name, email) tuple from the last modification entry
|
||||
pub fn parse_changelog_footer(path: &Path) -> Result<(String, String), Box<dyn std::error::Error>> {
|
||||
let mut file = File::open(path)?;
|
||||
let mut content = String::new();
|
||||
file.read_to_string(&mut content)?;
|
||||
|
||||
// Find the last maintainer line (format: -- Name <email> Date)
|
||||
let re = Regex::new(r"--\s*([^<]+?)\s*<([^>]+)>\s*")?;
|
||||
|
||||
if let Some(last_match) = re.captures_iter(&content).last() {
|
||||
let name = last_match
|
||||
.get(1)
|
||||
.map_or("", |m| m.as_str())
|
||||
.trim()
|
||||
.to_string();
|
||||
let email = last_match
|
||||
.get(2)
|
||||
.map_or("", |m| m.as_str())
|
||||
.trim()
|
||||
.to_string();
|
||||
Ok((name, email))
|
||||
} else {
|
||||
Err(format!("No maintainer information found in {}", path.display()).into())
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Obtain all commit messages as a list since a tagged version in a git repository
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user