4 files changed, +27, -3
50afa03Title releases with the tag message's first line
+1, -1
@@ -64,7 +64,7 @@ scp foo-linux-x86_64 foo-linux-aarch64 user@server:<repo>/releases/v1.2/
6464 git push origin v1.2
6565 ```
6666
67 -The repo gets a releases tab and a "latest release" row on its summary. The releases page shows each release's tag message as markdown and its files as download links, with their sizes and sha256 sums, followed by the tag's source code as `.zip` and `.tar.gz`.
67+The repo gets a releases tab and a "latest release" row on its summary. The releases page shows the first line of each release's tag message as its title, beside the tag's name, the rest of the message as markdown, and its files as download links, with their sizes and sha256 sums, followed by the tag's source code as `.zip` and `.tar.gz`.
6868
6969 wit hardlinks the files into the site, at `<repo>/releases/<tag>/`, so keep the repos and the site on one filesystem; otherwise it copies them on every rebuild. A hardlink has the upload's permissions, so the web server must be able to read the uploaded files. Serve the site over HTTPS only.
7070
+10, -1
@@ -705,11 +705,20 @@ pub fn gen_releases(repo: &RepoInfo, sums: &[Vec<(usize, String)>]) -> String {
705705 let Some(tag) = repo.tags.iter().find(|t| t.name == release.tag) else {
706706 continue;
707707 };
708+ let (hover, title) = if release.title.is_empty() {
709+ Default::default()
710+ } else {
711+ let title = escape_str(&release.title);
712+ (
713+ format!(" title=\"{title}\""),
714+ format!("<span class=\"rel-title\">{title}</span>"),
715+ )
716+ };
708717 body.push_str(&format!(
709718 "\
710719 <section id=\"release-{}\" class=\"box mt-0 p-0 rel\">\n\
711720 <div class=\"flex items-center gap-2 px border-b rel-head\">\n\
712 -<div class=\"flex-1 flex items-center gap rel-name\">{}<a class=\"truncate\" href=\"../{}\">{}</a></div>\n\
721+<div class=\"flex-1 flex items-center gap rel-name\">{}<a class=\"truncate\" href=\"../{}\"{hover}>{}{title}</a></div>\n\
713722 <div class=\"ml-auto flex items-center\">\n\
714723 <div class=\"flex items-center tree-commit short-id\">{}</div>\n\
715724 {}\
+7, -1
@@ -114,6 +114,7 @@ impl RefInfo {
114114 pub struct Release {
115115 pub tag: String,
116116 pub date: DateTime<FixedOffset>,
117+ pub title: String,
117118 pub notes: String,
118119 pub dir: PathBuf,
119120 pub files: Vec<String>,
@@ -521,11 +522,15 @@ fn read_releases(repo: &Repository, path: &str, tags: &[RefInfo]) -> Result<Vec<
521522 files.sort();
522523 let tag_ref = repo.find_reference(&format!("refs/tags/{}", tag.name))?;
523524 let annotated = tag_ref.peel_to_tag().ok();
524 - let notes = annotated
525+ let message = annotated
525526 .as_ref()
526527 .and_then(|t| t.message_bytes())
527528 .map(|m| String::from_utf8_lossy(m).trim().to_string())
528529 .unwrap_or_default();
530+ let (title, notes) = message.split_once('\n').unwrap_or((&message, ""));
531+ let title = Some(title.trim()).filter(|title| *title != tag.name);
532+ let title = title.unwrap_or_default().to_string();
533+ let notes = notes.trim().to_string();
529534 let date = annotated
530535 .as_ref()
531536 .and_then(|t| t.tagger())
@@ -534,6 +539,7 @@ fn read_releases(repo: &Repository, path: &str, tags: &[RefInfo]) -> Result<Vec<
534539 releases.push(Release {
535540 tag: tag.name.clone(),
536541 date,
542+ title,
537543 notes,
538544 dir,
539545 files,
+9, -0
@@ -1957,6 +1957,14 @@ a.brand,
19571957 font-weight: 600;
19581958 }
19591959
1960+.rel-title {
1961+ font-weight: 400;
1962+}
1963+
1964+.rel-title::before {
1965+ color: var(--muted);
1966+}
1967+
19601968 .rel-sum {
19611969 min-width: 0;
19621970 }
@@ -1974,6 +1982,7 @@ a.brand,
19741982
19751983 .commit-by::before,
19761984 .short-id::after,
1985+.rel-title::before,
19771986 .commit-title > .commit-id::after {
19781987 content: "\a0\b7\a0";
19791988 }