Release: publish script, and remove broken trimming from the release workflow #6
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Promotes
devtomain. Addspublish.ps1and disarms a release workflow that would publish non-functional artifacts.Why this one matters
maincurrently carries-p:PublishTrimmed=trueon both publish steps in.forgejo/workflows/release.yml. Trimming disables reflection-based serialization, andSiteConfigandSiteStateare both bound withSystem.Text.Jsonreflection. A trimmed build compiles with six IL2026 warnings and then throws before reading the first config file:Tagging any
v*release frommainas it stands would publish a linux-x64 and a win-x64 artifact that cannot start. No tags exist in this repository, so nothing broken has ever shipped, and the currently deployed binary was published manually rather than through the workflow, so it is unaffected.This PR removes trimming from both steps.
Contents
publish.ps1| new, wraps thedotnet publishinvocation.forgejo/workflows/release.yml| removePublishTrimmedfrom both publish stepsREADME.md| document the script; warn against re-adding trimmingARCHITECTURE.md| Building section with the same warning219 insertions, 3 deletions.
publish.ps1
Writes self-contained single-file binaries to
publish/<runtime>/, which is already gitignored. Tests run first so a failing build produces no artifact.It deliberately offers no trimming switch, because a switch that produces a non-functional binary is a trap. Re-enabling trimming would require a
JsonSerializerContextsource generator forSiteConfigandSiteState; that requirement is recorded in the script header,README.md, andARCHITECTURE.md.Verification
publish.ps1parse-validated with[Parser]::ParseFile, 0 errors, CRLF throughout, comment-based help present.dotnet test: 22 passed, 0 failed.Notes
mainis already an ancestor ofdev, so this should not be flagged out-of-date. PR #5's branch carried the reconciliation.<Version>stays at1.1.0. No application code changed in this PR, only build tooling and the workflow, so a rebuild reports the same version with a different commit hash. Say if you would prefer 1.1.1 so the deployed build is distinguishable.Assumptions
daily_postcheck.Deployment
None required. This changes build tooling and CI only; no application behaviour is altered.
publish.ps1 wraps the dotnet publish invocation so a developer does not have to remember the flag combination. It runs the tests first so a failing build produces no artifact, writes self-contained single-file binaries to publish/ (already gitignored), and supports -Runtime all for cross-platform builds. Building the trimmed variant to check whether the release workflow was safe showed that it is not. PublishTrimmed disables reflection-based serialization, and both SiteConfig and SiteState are bound with System.Text.Json reflection. The build emits six IL2026 warnings and the resulting binary throws before reading the first config file: System.InvalidOperationException: Reflection-based serialization has been disabled for this application. release.yml carried -p:PublishTrimmed=true on both the linux-x64 and win-x64 steps, so tagging any v* release would have published two artifacts that cannot start. No tags exist yet, so nothing broken was ever shipped. Removed from both steps. publish.ps1 deliberately offers no trimming switch, because a switch that produces a non-functional binary is a trap. Re-enabling it would require a JsonSerializerContext source generator for those two models; that requirement is recorded in the script header, README.md, and ARCHITECTURE.md so it is not naively re-added. Verified: untrimmed publish output runs all five checks against the live site and exits 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>