ci(release): publish the public releases repository; fix signing and token conditions
The step conditions read step-level env, which a step's own if cannot see: signing never ran and every release went to this repository. Secrets now surface as job-level HAS_* flags. The publish job sets up .NET for make-icon, re-publishing a tag updates the existing release, the portable zip carries portable.txt, and tags are validated before anything is built. deploy/releases-repo holds the public README, EULA draft, SECURITY policy and issue forms; release.yml copies them with the Unraid template, compose file, screenshots, i18n and SHA256SUMS. The fixtures command reports missing samples as warning annotations (--allow-missing) instead of a silent pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
11 files changed
+588
-59
No files matched your search
@@ -15,7 +15,7 @@ public static class ProductLinks
|
||||
public static string LatestReleaseApi => $"https://api.github.com/repos/{ReleasesRepository}/releases/latest";
|
||||
|
||||
/// <summary>The licence (EULA) published with the releases (BRIEF §12.9).</summary>
|
||||
public static string Licence => $"{Repository}/blob/HEAD/LICENSE.md";
|
||||
public static string Licence => $"{Repository}/blob/HEAD/EULA.md";
|
||||
|
||||
/// <summary>Where translations are reviewed by the community (BRIEF §16).</summary>
|
||||
public static string Issues => $"{Repository}/issues";
|
||||
|
||||
@@ -10,18 +10,20 @@ namespace Titano.Tools.Commands;
|
||||
/// §20.2): interrupted downloads resume from their <c>.part</c> file with an HTTP range request, every file is verified
|
||||
/// against its SHA-256, and verified files are skipped. An entry whose <c>sha256</c> is null gets the hash of its first
|
||||
/// download recorded in <c>external/recorded-hashes.json</c> (later runs verify against it) and printed so it can be
|
||||
/// copied into the manifest.
|
||||
/// copied into the manifest. A fixture that cannot be fetched is reported as a GitHub warning annotation when running
|
||||
/// in Actions (tests that need it skip); <c>--allow-missing</c> then keeps the exit code 0, so CI shows the warning
|
||||
/// instead of a silently "passed" step.
|
||||
/// </summary>
|
||||
internal sealed class FixturesCommand : ICommand
|
||||
{
|
||||
private const string RecordedHashesFile = "recorded-hashes.json";
|
||||
|
||||
public string Name => "fixtures";
|
||||
public string Summary => "Download and verify the CC0 RAW samples in tests/fixtures/manifest.json (--manifest, --out)";
|
||||
public string Summary => "Download and verify the CC0 RAW samples in tests/fixtures/manifest.json (--manifest, --out, --allow-missing)";
|
||||
|
||||
public async Task<int> RunAsync(string[] args)
|
||||
{
|
||||
var a = new Args(args);
|
||||
var a = new Args(args, "allow-missing");
|
||||
var root = Args.RepoRoot();
|
||||
var manifestPath = a.Get("manifest") ?? Path.Combine(root, "tests", "fixtures", "manifest.json");
|
||||
var outDir = a.Get("out") ?? Path.Combine(root, "tests", "fixtures", "external");
|
||||
@@ -33,7 +35,7 @@ internal sealed class FixturesCommand : ICommand
|
||||
? JsonSerializer.Deserialize<Dictionary<string, string>>(await File.ReadAllTextAsync(recordedPath)) ?? []
|
||||
: [];
|
||||
var newlyRecorded = new List<string>();
|
||||
var failures = 0;
|
||||
var missing = new List<(Entry Entry, string Reason)>();
|
||||
using var http = new HttpClient { Timeout = TimeSpan.FromMinutes(10) };
|
||||
http.DefaultRequestHeaders.UserAgent.ParseAdd("Titano.Tools/1.0 (+fixtures)");
|
||||
foreach (var entry in entries)
|
||||
@@ -65,7 +67,7 @@ internal sealed class FixturesCommand : ICommand
|
||||
}
|
||||
catch (Exception ex) when (ex is HttpRequestException or IOException or InvalidDataException or TaskCanceledException or UnauthorizedAccessException)
|
||||
{
|
||||
failures++;
|
||||
missing.Add((entry, ex.Message));
|
||||
Console.Error.WriteLine($"failed {entry.Name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
@@ -75,8 +77,18 @@ internal sealed class FixturesCommand : ICommand
|
||||
Console.WriteLine("Recorded SHA-256 of first downloads (copy into the manifest to pin them):");
|
||||
foreach (var line in newlyRecorded) Console.WriteLine(" " + line);
|
||||
}
|
||||
Console.WriteLine(failures == 0 ? $"{entries.Count} fixture(s) ready in {outDir}" : $"{failures} of {entries.Count} fixture(s) failed");
|
||||
return failures == 0 ? 0 : 1;
|
||||
if (missing.Count == 0)
|
||||
{
|
||||
Console.WriteLine($"{entries.Count} fixture(s) ready in {outDir}");
|
||||
return 0;
|
||||
}
|
||||
Console.WriteLine($"{missing.Count} of {entries.Count} fixture(s) missing; the tests that need them are skipped.");
|
||||
if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true")
|
||||
{
|
||||
var manifestFile = Path.GetRelativePath(root, manifestPath).Replace('\\', '/');
|
||||
foreach (var (entry, reason) in missing) Console.WriteLine(Annotation(manifestFile, entry, reason));
|
||||
}
|
||||
return a.Has("allow-missing") ? 0 : 1;
|
||||
|
||||
void Record(string name, string hash)
|
||||
{
|
||||
@@ -86,7 +98,22 @@ internal sealed class FixturesCommand : ICommand
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed record Entry(string Name, Uri Url, string? Sha256, long? Size);
|
||||
internal sealed record Entry(string Name, Uri Url, string? Sha256, long? Size, string? Format);
|
||||
|
||||
/// <summary>A GitHub Actions warning naming the missing fixture, why, and where the fix goes.</summary>
|
||||
internal static string Annotation(string manifestFile, Entry entry, string reason)
|
||||
{
|
||||
var message = $"{entry.Name} ({entry.Format ?? "RAW"}) could not be fetched from {entry.Url.AbsoluteUri}: {reason.TrimEnd('.')}. " +
|
||||
"Its decode tests are skipped. Replace the url in the manifest (see its 'instructions').";
|
||||
return $"::warning file={Escape(manifestFile, property: true)},title={Escape("RAW fixture missing", property: true)}::{Escape(message, property: false)}";
|
||||
}
|
||||
|
||||
/// <summary>Workflow-command escaping (properties also escape ':' and ',').</summary>
|
||||
private static string Escape(string value, bool property)
|
||||
{
|
||||
var escaped = value.Replace("%", "%25", StringComparison.Ordinal).Replace("\r", "%0D", StringComparison.Ordinal).Replace("\n", "%0A", StringComparison.Ordinal);
|
||||
return property ? escaped.Replace(":", "%3A", StringComparison.Ordinal).Replace(",", "%2C", StringComparison.Ordinal) : escaped;
|
||||
}
|
||||
|
||||
internal static List<Entry> ReadManifest(string path)
|
||||
{
|
||||
@@ -101,7 +128,8 @@ internal sealed class FixturesCommand : ICommand
|
||||
throw new ToolException($"Fixture {name} needs an https URL");
|
||||
var sha = f.TryGetProperty("sha256", out var s) && s.ValueKind == JsonValueKind.String ? s.GetString() : null;
|
||||
long? size = f.TryGetProperty("size", out var z) && z.ValueKind == JsonValueKind.Number ? z.GetInt64() : null;
|
||||
entries.Add(new Entry(name, url, sha, size));
|
||||
var format = f.TryGetProperty("format", out var fm) && fm.ValueKind == JsonValueKind.String ? fm.GetString() : null;
|
||||
entries.Add(new Entry(name, url, sha, size, format));
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user