diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index b93acd0..1344c32 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -22,6 +22,15 @@ jobs: - name: Prepare run: .gitea/scripts/prepare.sh + - name: Release notes from the commit messages since the previous tag + uses: https://git.thepra.dev/Arasaka/app-stores/changelog@v1 + with: + prefix: v + name: me-web? + strip: '^["“]?me-web\?["”]? [\d.]+:\s*' + packager: Arasaka di Hvozdikov Yevheniy + output: artifacts/notes + - name: The server run: tools/release.sh server --commit "$COMMIT" @@ -43,6 +52,9 @@ jobs: MEWEB_KEYSTORE_PASS: ${{ secrets.MEWEB_KEYSTORE_PASS }} run: .gitea/scripts/android.sh + - name: The changelog beside the files + run: cp artifacts/notes/CHANGELOG.md "releases/$VERSION/" + - name: The rpm signed with the Arasaka packages key if: ${{ github.ref_type == 'tag' }} env: diff --git a/tools/release.cs b/tools/release.cs index 36fdbd0..609d212 100644 --- a/tools/release.cs +++ b/tools/release.cs @@ -78,7 +78,8 @@ return failed ? 1 : 0; void WriteNotes() { var source = Path.Combine(root, "artifacts", "knowledge", "SOURCE.txt"); - var lines = Changes(); + var notes = Path.Combine(root, "artifacts", "notes", "notes.md"); + var lines = File.Exists(notes) ? [.. File.ReadAllLines(notes), ""] : new List(); lines.AddRange( [ $"me-web? {version}, commit {commit}, built {builtAt}.", @@ -92,26 +93,6 @@ void WriteNotes() File.WriteAllLines(Path.Combine(root, "artifacts", "release-notes.md"), lines); } -List Changes() -{ - var previous = Capture("git", "-C", root, "describe", "--tags", "--abbrev=0", "--match", "v*", "HEAD^").Trim(); - var log = Capture("git", "-C", root, "log", "--no-merges", "--reverse", "--format=%x1e%s%x1f%b", previous.Length > 0 ? $"{previous}..HEAD" : "HEAD"); - var lines = new List(); - foreach (var entry in log.Split('\x1e', StringSplitOptions.RemoveEmptyEntries)) - { - var parts = entry.Split('\x1f'); - var subject = Regex.Replace(parts[0].Trim(), @"^[""“]?me-web\?[""”]? [\d.]+:\s*", ""); - if (subject.Length == 0) continue; - var body = (parts.Length > 1 ? parts[1] : "").Split('\n').Select(l => l.TrimEnd()) - .Where(l => !Regex.IsMatch(l, @"^[A-Za-z-]+-(By|Session|Off-By):", RegexOptions.IgnoreCase)) - .Where(l => !l.Contains("claude", StringComparison.OrdinalIgnoreCase)) - .SkipWhile(l => l.Length == 0).Reverse().SkipWhile(l => l.Length == 0).Reverse().ToList(); - lines.AddRange([$"### {char.ToUpperInvariant(subject[0])}{subject[1..]}", ""]); - if (body.Count > 0) lines.AddRange([.. body, ""]); - } - return lines.Count == 0 ? [] : [$"## What's new in {version}", "", .. lines]; -} - string[] Stamp() => [$"-p:Version={version}", $"-p:BuildCommit={commit}", $"-p:BuildTimeUtc={builtAt}"]; string Linux() @@ -151,6 +132,8 @@ string Linux() var png = Path.Combine(branding, "meweb-512.png"); var svg = Path.Combine(branding, "meweb.svg"); var yaml = Path.Combine(stage, "nfpm.yaml"); + var history = Path.Combine(root, "artifacts", "notes", "changelog.yml"); + var changelog = File.Exists(history) ? $"changelog: {history}" : ""; File.WriteAllText(yaml, $""" name: meweb arch: amd64 @@ -163,6 +146,7 @@ string Linux() vendor: Arasaka di Hvozdikov Yevheniy homepage: https://git.thepra.dev/Arasaka/MeWeb license: AGPL-3.0-only + {changelog} description: | Can you run your own server from here? “me-web?” checks your connection and device and explains, in plain words, what you could host at home and what stands in the way.