Files
frameledger/.github/workflows/release.yml
T
poli0981andClaude Opus 5.5 648e9c28b1 build: the alpha line - RELEASE_LINE stamped into every assembly, release.yml's line-vs-tag rule and Velopack alpha channel, CI on the alpha branch, no wiki for an alpha (D73) (beta.32 PR-1) (#344)
The owner, 2026-10-31: an alpha build where new .NET versions are tried, .NET 11 RC3 / C# 15 first,
with an experimental-build warning (owner decisions D73-D76, asked while planning). This is the
plumbing on main; it changes nothing in a beta.

- RELEASE_LINE (main | alpha), read like VERSION by Directory.Build.props, stamped as the
  FrameLedger.ReleaseLine assembly metadata; any other value is a build error. Shared.BuildLine
  reads it back for composition (BuildLineTests, AssemblyIdentityTests).
- release.yml: the version gate reads RELEASE_LINE - the alpha line takes vX.Y.Z-alpha.N and
  nothing else, no other line may carry an -alpha. tag; an alpha's vpk download and pack take
  --channel alpha (feed releases.alpha.json, asset names from assets.<channel>.json); the main
  line's pack command is unchanged. An alpha's release is titled "(experimental alpha)".
- ci.yml: also on pushes to alpha; no sonarcloud job and no Changelog step for pull requests into
  alpha. wiki.yml: no publish after an -alpha. tag.
- tools/fps-impact-runbook.ps1: the Agent path no longer names a TFM.
- Docs: 12_BUILD §The alpha line, 13_CI_CD §The alpha line (+ ci/release/wiki sections, branch
  policy), 11_UPDATER §Channels corrected in place (the alpha line uses Velopack channels;
  GithubSource reads the newest ten releases, hence one alpha per beta), 20_OPEN_QUESTIONS §G
  "The main line's .NET" with its decision table written first, CLAUDE.md, CHANGELOG.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:58:38 +00:00

348 lines
21 KiB
YAML

# FrameLedger release (docs/13_CI_CD.md §release.yml, docs/12_BUILD.md §Publish & package).
#
# On a tag `v*`: the same gate ci.yml runs, then publish → pack → checksums →
# a GitHub Release whose body is CHANGELOG.md's section for the version. Three
# things are refused loudly rather than papered over, because a release is the
# one artefact nobody can re-run:
# - the tag's numeric core must equal the VERSION file (the one version source;
# the native VERSIONINFO blocks are built from it and versioninfo-check
# compares them);
# - CHANGELOG.md must carry a non-empty `## [x.y.z]` section for the tag
# (tools/release-notes.ps1) — an empty release body is a defect, not a default;
# - the published tree must hold both entry points and every shipped native
# binary, checked by name, because `dotnet publish` warns rather than fails
# when a .targets-staged DLL is missing.
#
# Unsigned by policy (11_UPDATER §Unsigned releases): SHA256SUMS.txt is published
# beside the assets and printed into the release body.
#
# A pre-release tag (`v0.1.0-beta.1`, 13_CI_CD §Branch & release policy) marks the
# GitHub release as pre-release; the App's stable channel ignores it and the beta
# channel sees it. The managed assemblies take the tag's full version through
# -p:Version; the native blocks keep the numeric core (CMake's project() accepts
# nothing else).
#
# THE ALPHA LINE (2026-10-31, owner decisions D73-D76; 12_BUILD §The alpha line): the
# RELEASE_LINE file says `alpha` on the long-lived `alpha` branch, where the same source
# builds on a prerelease .NET. Its tags are `vX.Y.Z-alpha.N` and nothing else, no other
# line may carry one, and its packages go to Velopack's `alpha` channel
# (releases.alpha.json) - which no beta reads, as no alpha reads releases.win.json
# (11_UPDATER §Channels). The version gate below enforces all three.
#
# A DRY RUN (2026-09-16, P5 prep): `workflow_dispatch` with a version runs every
# step below — the gate, the publish, the tree assertion, vpk, the checksums — and
# uploads the result as a workflow artifact, but creates no tag and no Release.
# It is the first-tag measurement without the tag: 13_CI_CD §release.yml said the
# workflow "has not been exercised by a tag yet", and everything after the version
# gate had only ever run by hand on one machine. In a dry run a missing
# `## [x.y.z]` CHANGELOG section is a printed warning with placeholder notes rather
# than a stop, because the section is written in the tag commit and a dry run
# precedes it; on a real tag it stays a hard stop.
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
version:
description: 'Version to rehearse (e.g. 0.1.0-beta.1): numeric core must equal VERSION; no tag, no Release'
required: true
type: string
# The Release API is contents: write; nothing else is needed and nothing else is granted.
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- name: Set up .NET
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
- name: Set up MSVC (x64)
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: x64
# Same pin as ci.yml, for the same reason (the gate's clang-format step).
- name: Pin clang-format
shell: pwsh
run: |
pip install --disable-pip-version-check "clang-format==22.1.3"
clang-format --version
- name: Cache NuGet
uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('**/Directory.Packages.props', 'global.json') }}
restore-keys: nuget-${{ runner.os }}-
- name: Version gate (tag vs VERSION, CHANGELOG section)
id: version
shell: pwsh
env:
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' }}
DISPATCHED_VERSION: ${{ inputs.version }}
run: |
$ErrorActionPreference = 'Stop'
$dry = $env:DRY_RUN -eq 'true'
$tag = if ($dry) { 'v' + $env:DISPATCHED_VERSION.TrimStart('v') } else { $env:GITHUB_REF_NAME }
$m = [regex]::Match($tag, '^v(\d+\.\d+\.\d+)(-[0-9A-Za-z.]+)?$')
if (-not $m.Success) { throw "tag '$tag' is not vMAJOR.MINOR.PATCH[-prerelease]" }
$full = $tag.Substring(1)
$core = $m.Groups[1].Value
$pre = if ($m.Groups[2].Success) { 'true' } else { 'false' }
$file = (Get-Content VERSION -Raw).Trim()
if ($core -ne $file) { throw "tag $tag has numeric core $core but VERSION says $file — bump VERSION in the same commit as the changelog section, then tag" }
# D73: the release line this commit builds (Directory.Build.props refuses any other value too) and the tags it may
# carry - an alpha's on the alpha line only, and nothing else there.
$line = (Get-Content RELEASE_LINE -Raw).Trim()
if ($line -cnotin @('main', 'alpha')) { throw "RELEASE_LINE says '$line'; it must be main or alpha" }
$suffix = $m.Groups[2].Value
if ($line -eq 'alpha' -and $suffix -cnotmatch '^-alpha\.\d+$') { throw "this commit is on the alpha line (RELEASE_LINE); its tag must be vX.Y.Z-alpha.N, not $tag" }
if ($line -ne 'alpha' -and $suffix -match 'alpha') { throw "tag $tag names an alpha, but RELEASE_LINE says '$line': an alpha is tagged on the alpha branch, nowhere else" }
$channel = if ($line -eq 'alpha') { 'alpha' } else { 'win' }
New-Item -ItemType Directory -Force out | Out-Null
./tools/release-notes.ps1 -Version $full -OutFile out/notes.md
if ($LASTEXITCODE -ne 0) {
if (-not $dry) { throw 'release notes' }
Write-Host "::warning::CHANGELOG.md has no '## [$full]' section yet - a dry run continues with placeholder notes; a real tag stops here"
[System.IO.File]::WriteAllText('out/notes.md', "DRY RUN of $full - CHANGELOG.md has no ``## [$full]`` section yet.`n", [System.Text.UTF8Encoding]::new($false))
# The runner's pwsh wrapper ends the step with `exit $LASTEXITCODE`, so a handled failure must clear it
# (measured 2026-09-16: the first rehearsal printed the warning and then failed with the script's exit 1).
$global:LASTEXITCODE = 0
}
"version=$full" >> $env:GITHUB_OUTPUT
"prerelease=$pre" >> $env:GITHUB_OUTPUT
"channel=$channel" >> $env:GITHUB_OUTPUT
"dry_run=$($dry.ToString().ToLowerInvariant())" >> $env:GITHUB_OUTPUT
Write-Host "$(if ($dry) { 'DRY RUN of' } else { 'releasing' }) $full (pre-release: $pre; line: $line; Velopack channel: $channel)"
# The Overlay's build id is `git describe --dirty` at CMake's configure
# (src/native/FrameLedger.Shm/CMakeLists.txt), and the next step edits tracked
# files: every release until beta.18 shipped "<tag>-dirty". So the id is read
# here, from the clean checkout, and handed to CMake through the environment;
# buildid-check reads it back out of the published binaries.
- name: Build id (the clean checkout)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$id = "$(git describe --always --dirty --abbrev=12)".Trim()
if ($LASTEXITCODE -ne 0 -or -not $id) { throw 'git describe failed' }
if ($id.EndsWith('-dirty')) { throw "the checkout is dirty before the release has touched it: $id" }
if ($id.Length -gt 31) { throw "build id '$id' is $($id.Length) characters; FlShmHandshake::buildId holds 31" }
"FL_BUILD_ID=$id" >> $env:GITHUB_ENV
Write-Host "FL_BUILD_ID = $id"
# 12_BUILD §Release-time token substitution: the effective date of a legal
# document is the date it ships. The only placeholder that survives into the
# repository, substituted here and nowhere else; the App embeds legal/*.md at
# build time, so this runs BEFORE the build.
- name: Substitute {{RELEASE_DATE}}
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$date = (Get-Date).ToUniversalTime().ToString('yyyy-MM-dd')
$n = 0
foreach ($f in Get-ChildItem legal -Filter *.md) {
$t = Get-Content $f.FullName -Raw
if ($t.Contains('{{RELEASE_DATE}}')) {
[System.IO.File]::WriteAllText($f.FullName, $t.Replace('{{RELEASE_DATE}}', $date), [System.Text.UTF8Encoding]::new($false))
$n++
}
}
Write-Host "RELEASE_DATE = $date in $n file(s)"
if (Select-String -Path legal/*.md, README.md -Pattern '\{\{' -Quiet) { throw 'a {{ token survived substitution' }
# The identical gate ci.yml runs — native build, tests, every check including
# versioninfo-check against VERSION. A release never skips it.
- name: Quality gate
shell: pwsh
run: ./build.ps1 check
env:
CI: 'true'
- name: Publish App + Agent (self-contained, ReadyToRun)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$v = '${{ steps.version.outputs.version }}'
# beta.12: the App's links into the repository open the documents of THIS release (Services/RepositoryLinks.cs):
# the tag, or for a rehearsal - which has no tag - the commit it was built from.
$ref = if ('${{ steps.version.outputs.dry_run }}' -eq 'true') { '${{ github.sha }}' } else { "v$v" }
dotnet publish src/FrameLedger.App -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:Version=$v -p:FrameLedgerSourceRef=$ref -o out/app
if ($LASTEXITCODE -ne 0) { throw 'App publish failed' }
# beta.14 (D50): the same ref for the Agent - Directory.Build.props stamps it on every assembly, and both
# publishes build the same libraries into this one folder.
dotnet publish src/FrameLedger.Agent -c Release -r win-x64 --self-contained -p:PublishReadyToRun=true -p:Version=$v -p:FrameLedgerSourceRef=$ref -o out/app
if ($LASTEXITCODE -ne 0) { throw 'Agent publish failed' }
# A self-contained package redistributes the .NET runtime, and its licence and
# third-party notices are ours to pass on (P4 PR-6). Not committed with the
# NuGet texts in legal/licenses/nuget: the runtime version follows the SDK of
# the machine that publishes, so the exact packs are read from the published
# runtimeconfig and copied from the NuGet cache the publish just used.
- name: Ship the .NET runtime's licence and notices
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$config = Get-Content out/app/FrameLedger.runtimeconfig.json -Raw | ConvertFrom-Json
$frameworks = @($config.runtimeOptions.includedFrameworks)
if ($frameworks.Count -eq 0) { throw 'FrameLedger.runtimeconfig.json lists no included framework -- the publish was not self-contained' }
$cache = if ($env:NUGET_PACKAGES) { $env:NUGET_PACKAGES } else { Join-Path $HOME '.nuget/packages' }
$dest = New-Item -ItemType Directory -Force out/app/licenses/dotnet
foreach ($fw in $frameworks) {
$pack = Join-Path $cache ('{0}.runtime.win-x64/{1}' -f $fw.name.ToLowerInvariant(), $fw.version)
$files = @(Get-ChildItem $pack -File | Where-Object { $_.Name -match '^(LICENSE|THIRD-PARTY-NOTICES)(\.TXT)?$' })
if ($files.Count -eq 0) { throw "no licence file in $pack" }
foreach ($f in $files) {
Copy-Item $f.FullName (Join-Path $dest ('{0}-{1}-{2}' -f $fw.name, $fw.version, $f.Name))
}
}
Get-ChildItem $dest | ForEach-Object { Write-Host (" {0,-64} {1,8:N0}" -f $_.Name, $_.Length) }
# What ships is what matters: the two entry points and the five shipped native
# binaries (versioninfo-check's list) must be in the tree, and the unshipped
# capture host must not be (package-closure-check proves it statically; this
# reads the directory).
- name: Assert the published tree
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$required = 'FrameLedger.exe', 'FrameLedger.Agent.exe', 'FrameLedger.Overlay.dll', 'FrameLedger.VkLayer.dll', 'FrameLedger.Guard.dll', 'FrameLedger.NvapiBridge.dll', 'FrameLedger.ProcessStats.dll', 'rules/detection-rules.json',
'licenses/nuget/INDEX.md', 'licenses/THIRD_PARTY_NOTICES.md', 'licenses/FrameLedger-GPL-3.0.txt', 'licenses/NOTICE.txt', 'licenses/mpl-2.0.txt', 'licenses/apache-2.0.txt'
$missing = @($required | Where-Object { -not (Test-Path (Join-Path out/app $_)) })
if ($missing.Count -gt 0) { throw "out/app is missing: $($missing -join ', ')" }
if (Test-Path out/app/FrameLedger.CaptureHost.exe) { throw 'out/app contains the unshipped capture host (12_BUILD: exactly two roots)' }
if (@(Get-ChildItem out/app/licenses/dotnet -File -ErrorAction SilentlyContinue).Count -lt 2) { throw 'out/app/licenses/dotnet holds fewer than two files -- the runtime licence step did not run' }
# beta.14 (D50): the managed half too - the eight managed binaries, carrying the tag's full version.
./tools/versioninfo-check.ps1 -BuildDir out/app -ManagedDir out/app -ExpectedProductVersion '${{ steps.version.outputs.version }}'
if ($LASTEXITCODE -ne 0) { throw 'versioninfo-check over the published tree' }
# beta.18: the native binaries carry the build id read from the clean checkout, exactly - never "<tag>-dirty".
./tools/buildid-check.ps1 -BuildDir out/app -Expected $env:FL_BUILD_ID
if ($LASTEXITCODE -ne 0) { throw 'buildid-check over the published tree' }
$size = (Get-ChildItem out/app -Recurse -File | Measure-Object Length -Sum).Sum / 1MB
Write-Host ("published tree: {0:N0} MB" -f $size)
# Velopack's packer, pinned to the library version the App references
# (Directory.Packages.props). No --icon: assets/icon.ico does not exist yet
# (12_BUILD §Publish & package says so rather than pointing at a file that is not there).
#
# --packId is FrameLedger.App, NOT FrameLedger, and that is a data-loss rule:
# Velopack installs into %LOCALAPPDATA%\<packId> and deletes that directory on
# uninstall, and %LOCALAPPDATA%\FrameLedger is the DATA folder (LedgerPaths:
# ledger.db, logs, the layer manifest). The same id would put the install inside
# the ledger's folder and have the uninstaller remove every session without the
# question 12_BUILD promises. The title the user sees is still "FrameLedger".
# A DELTA (beta.13): vpk pack diffs against the newest full package already in --outputDir, and until beta.13 that
# directory was always empty - so no release carried a delta and every update downloaded the whole package
# (11_UPDATER §Built). The previous release is downloaded first; what THIS pack produced is assets.win.json, and only
# that is kept: the previous full package moves out (not uploaded, not checksummed) and the feed lists this build
# alone, as `vpk upload github` would write it. No previous release, or a download that fails, is a full-only
# release - said as a warning, not a stop, because it is exactly what every release before this one was.
- name: Pack (Velopack)
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$ErrorActionPreference = 'Stop'
dotnet tool install -g vpk --version 1.2.161
if ($LASTEXITCODE -ne 0) { throw 'vpk install failed' }
$v = '${{ steps.version.outputs.version }}'
# D73: `win` (Velopack's default on Windows) for the main line, `alpha` for the alpha line - each release's feed
# and the previous release its delta is made from are its own line's. The main line's pack keeps its exact
# command (no --channel), so a beta is packed as every beta before the alpha line existed.
$channel = '${{ steps.version.outputs.channel }}'
New-Item -ItemType Directory out/release -Force | Out-Null
vpk download github --repoUrl "https://github.com/${{ github.repository }}" --channel $channel --pre --token $env:GH_TOKEN --outputDir out/release
if ($LASTEXITCODE -ne 0) { Write-Host '::warning::the previous release could not be downloaded - this release carries a full package only' }
Write-Host 'previous release:'
Get-ChildItem out/release -File | ForEach-Object { Write-Host (" {0,-48} {1,12:N0}" -f $_.Name, $_.Length) }
$pack = @('pack', '--packId', 'FrameLedger.App', '--packVersion', $v, '--packDir', 'out/app', '--mainExe', 'FrameLedger.exe', '--packTitle', 'FrameLedger', '--packAuthors', 'FrameLedger', '--releaseNotes', 'out/notes.md', '--outputDir', 'out/release')
if ($channel -ne 'win') { $pack += @('--channel', $channel) }
vpk @pack
if ($LASTEXITCODE -ne 0) { throw 'vpk pack failed' }
$assets = "assets.$channel.json"
$index = "releases.$channel.json"
$legacyName = if ($channel -eq 'win') { 'RELEASES' } else { "RELEASES-$channel" }
$built = @((Get-Content "out/release/$assets" -Raw | ConvertFrom-Json) | ForEach-Object { $_.RelativeFileName })
if ($built.Count -eq 0) { throw "vpk pack wrote no $assets entries" }
$keep = $built + @($index, $assets, $legacyName)
New-Item -ItemType Directory out/previous -Force | Out-Null
Get-ChildItem out/release -File | Where-Object { $keep -notcontains $_.Name } | Move-Item -Destination out/previous
$feed = Get-Content "out/release/$index" -Raw | ConvertFrom-Json
$feed.Assets = @($feed.Assets | Where-Object { $built -contains $_.FileName })
if ($feed.Assets.Count -eq 0) { throw 'the feed lists none of this build''s packages' }
[System.IO.File]::WriteAllText((Join-Path $PWD "out/release/$index"), ($feed | ConvertTo-Json -Depth 8 -Compress), [System.Text.UTF8Encoding]::new($false))
if (Test-Path "out/release/$legacyName") {
$legacy = @(Get-Content "out/release/$legacyName" | Where-Object { $built -contains ($_ -split ' ')[1] })
[System.IO.File]::WriteAllLines((Join-Path $PWD "out/release/$legacyName"), [string[]]$legacy, [System.Text.UTF8Encoding]::new($false))
}
Write-Host 'this release:'
Get-ChildItem out/release | ForEach-Object { Write-Host (" {0,-48} {1,12:N0}" -f $_.Name, $_.Length) }
Write-Host ('feed: ' + (($feed.Assets | ForEach-Object { '{0} {1} {2}' -f $_.Type, $_.Version, $_.FileName }) -join '; '))
$setup = "FrameLedger.App-$channel-Setup.exe"
if (-not (Test-Path "out/release/$setup")) { throw "vpk did not produce $setup (README §Install names the beta's, guide/11-alpha-builds.md the alpha's)" }
$delta = "out/release/FrameLedger.App-$v-delta.nupkg"
if (Get-ChildItem out/previous -Filter '*-full.nupkg' -ErrorAction SilentlyContinue) {
if (-not (Test-Path $delta)) { throw "the previous full package was downloaded, but vpk produced no delta ($delta)" }
} else {
Write-Host '::warning::no previous full package - this release carries no delta'
}
- name: Checksums
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$lines = Get-ChildItem out/release -File | Sort-Object Name | ForEach-Object {
'{0} {1}' -f (Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLowerInvariant(), $_.Name
}
[System.IO.File]::WriteAllLines('out/release/SHA256SUMS.txt', $lines, [System.Text.UTF8Encoding]::new($false))
$notes = Get-Content out/notes.md -Raw
$notes += "`n`n## SHA-256`n`nReleases are not code-signed (11_UPDATER). Verify before running:`n`n``````text`n" + ($lines -join "`n") + "`n``````"
[System.IO.File]::WriteAllText('out/notes.md', $notes, [System.Text.UTF8Encoding]::new($false))
Get-Content out/release/SHA256SUMS.txt
- name: Create the GitHub Release
if: steps.version.outputs.dry_run != 'true'
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$ErrorActionPreference = 'Stop'
$v = '${{ steps.version.outputs.version }}'
# An alpha says what it is in the list of releases too, not only in its notes (D74).
$title = if ('${{ steps.version.outputs.channel }}' -eq 'alpha') { "FrameLedger $v (experimental alpha)" } else { "FrameLedger $v" }
$ghArgs = @('release', 'create', $env:GITHUB_REF_NAME, '--title', $title, '--notes-file', 'out/notes.md', '--verify-tag')
if ('${{ steps.version.outputs.prerelease }}' -eq 'true') { $ghArgs += '--prerelease' }
$ghArgs += Get-ChildItem out/release -File | ForEach-Object { $_.FullName }
gh @ghArgs
if ($LASTEXITCODE -ne 0) { throw 'gh release create failed' }
- name: Upload the published tree (for the smoke checklist)
if: always()
uses: actions/upload-artifact@v7
with:
name: release-${{ steps.version.outputs.version || github.ref_name }}${{ steps.version.outputs.dry_run == 'true' && '-dry-run' || '' }}
path: |
out/release/**
out/notes.md
if-no-files-found: warn
retention-days: 30