Files
Nemera/docs/technical/RELEASING.md
T
BinaryAlley b30cbd6b9e Adds bundled plugin trust and cross-platform native deployment
- embeds the append-only historical and deny trust lists in the API and marks matching bundled plugins as Official without blocking loading
- builds and records the current plugin manifest only for official release builds
- deploys the PDF native libraries for the supported Linux, macOS and Windows runtimes from the plugin dependency manifest
- records release hashes by appending only missing entries to master's manifest and rejects any diff that removes a line
- documents the release flow, the supported runtimes and the plugin installer limits
2026-11-28 18:00:00 +02:00

17 KiB

Releasing

Contents

Overview

Releases are cut only by the repository owner. There is one official build, and it runs on the release branch.

  1. The owner creates a release/x.y.z branch from master.
  2. The Publish Release workflow builds and publishes the official artifacts with OfficialReleaseBuild=true.
  3. The same workflow verifies the published API assembly against the published plugin binaries, records the release's plugin hashes in the append-only trust list, builds the release images from the verified publish output, and opens a pull request to master.
  4. The owner downloads the official artifacts and creates the GitHub release and tag.
  5. The owner merges the trust-list pull request. The current release already embeds its own official plugin manifest, so this pull request keeps the release's plugin binaries Official in future releases.

The full test suite runs on normal pull requests to master. The release build does not rerun the full suite. It runs the manifest verification tests for the official build, publishes, verifies the published API assembly against the published plugin binaries, records the hashes and builds the release images from the verified publish output.

The repository pins the .NET SDK in global.json. The workflows install that exact SDK, and the Docker build stage uses the matching 10.0.100 SDK image, so root-level and container builds use the same toolchain.

The release-api artifact is a single framework-dependent publish built on ubuntu-latest. The bundled plugin deployment keeps the PDF plugin's native libraries for the supported runtime identifiers: win-x64, win-arm64, linux-x64, linux-arm64, linux-musl-x64, osx-x64 and osx-arm64. The macOS packages also keep their shared SkiaSharp library in the osx fallback folder, which the build retains automatically even though no device reports that identifier. The list is defined by BundledPluginRuntimeIdentifiers in plugins/Directory.Build.props, and the PDF plugin validates its required native libraries for every identifier in it, accepting a library from either the identifier's own folder or its OS family fallback. The plugin resolves the matching native library at runtime from its dependency manifest. The release Docker images copy that same publish output.

The presentation host does not compile against the concrete plugin projects, and it does not own the bundled plugin catalog. The plugin projects are part of the solution and copy their outputs to the API plugin folder. build.proj owns the release catalog: it builds and hashes the plugin binaries, writes the current manifest, passes that manifest to the API publish, and copies the binaries into the published plugin folder. Adding or removing a bundled plugin changes the release catalog and the solution, not the host project.

Required GitHub settings

Release branch ruleset

Create a repository ruleset under Settings > Rules > Rulesets > New branch ruleset:

  • Target branches: refs/heads/release/*.
  • Enable Restrict creations, Restrict updates, Restrict deletions, and Block force pushes.
  • Bypass list: add only the owner's user account. Do not add the repository admin role if more than one administrator exists.

This prevents write collaborators from creating or pushing release branches. The ruleset enforces who can create the branch. The owner can create it from the GitHub Branches page or by pushing it.

The Publish Release workflow runs only when a branch matching release/x.y.z is created, and only when the actor is the repository owner.

Release environment

Create an environment under Settings > Environments > New environment named release:

  • Required reviewers: the owner.
  • Deployment branches: allow master and release/*. A create event runs on the branch that was created, so the publish job runs on the release branch; the record-manifest job checks out master in that same release-branch run.
  • Environment secrets:
    • SIXLABORS_LICENSE_KEY
    • RELEASE_PR_TOKEN

The publish job uses the license secret and has a read-only token. The record-manifest job uses the pull request token and does not have the license secret. The environment approval is the gate for both jobs.

Secrets

SIXLABORS_LICENSE_KEY

This is the Six Labors license key content.

  • The value to be put in the secret is the content of the license file, or the value already stored in the existing repository secret used by Run All Tests.
  • Run All Tests uses the repository secret SIXLABORS_LICENSE_KEY.
  • Publish Release uses the environment secret SIXLABORS_LICENSE_KEY in the release environment.
  • Publish Release also exposes the secret as the SixLaborsLicenseKey MSBuild environment property, so every project that references ImageSharp validates the license, not only Nemera.Domain.

If the key is missing or expired, the build fails with a message such as No Six Labors license found or an expired license error.

RELEASE_PR_TOKEN

This is a fine-grained GitHub personal access token owned by the repository owner.

Create it under Settings > Developer settings > Personal access tokens > Fine-grained tokens > Generate new token:

  • Resource owner: the owner's account.
  • Repository access: only BinaryAlley/Nemera.
  • Permissions:
    • Contents: Read and write
    • Pull requests: Read and write
    • Metadata: Read-only is added automatically.
  • Expiration: set an explicit date, for example 90 days, and add a calendar reminder.

Copy the generated github_pat_... value immediately. GitHub shows it only once. Store it as the RELEASE_PR_TOKEN environment secret in the release environment.

Why a personal access token is needed: pull requests created with the workflow GITHUB_TOKEN do not trigger pull_request workflows. The trust-list pull request must run Run All Tests and the branch validators, so the record-manifest job pushes and creates the pull request with this token.

The token is used only by the record-manifest job. It is not available to the build job, and the build job's token is read-only. The record-manifest checkout uses the token as its git token, so the persisted git credential is the PAT and both git push and gh pr create authenticate with it.

Workflows

  • Publish Release runs when the owner creates a release/x.y.z branch. It has two jobs:
    • publish: builds and publishes the official artifacts with OfficialReleaseBuild=true, runs the manifest verification tests, verifies the published API assembly against the published plugin binaries, records the released plugin hashes, builds the release images from the verified publish output, and uploads the release-api, release-web and bundled-plugins-manifest artifacts. It has the license secret and a read-only token.
    • record-manifest: downloads the manifest artifact, appends only the release entries that are missing from master's current trust list, and opens the other/record-release-x.y.z pull request to master with the RELEASE_PR_TOKEN. It does not have the license secret.
  • Run All Tests runs on pull requests to master and uses the repository SIXLABORS_LICENSE_KEY secret.
  • Branch Push Naming Convention Check and Pull Request Source Branch Validation Check allow feature/, bugfix/, hotfix/, documentation/, refactor/, other/, and release/x.y.z.

The release branch is built from master after the normal pull request checks have passed. The release build does not rerun the full test suite. It runs the manifest verification tests, because that is the only part of the build that changes when the official plugin manifest and the official release marker are embedded. It then verifies the published API assembly against the published plugin binaries before recording hashes or building images. The trust-list pull request runs the full suite before it can be merged.

Recording is CI-only. The publish job checks that the worktree is clean and that HEAD matches origin/master before it appends to the trust list. A local RecordBundledPlugins run is rejected by the guard.

The trust list build/BundledPlugins.manifest is append-only. Never remove existing entries. The record job uses master's current file as the base and appends only the entries that are missing from it, skipping duplicates, so the record pull request diff contains additions only. Use the release workflow, which calls RecordBundledPlugins, instead of editing the file by hand. The deny list build/BundledPlugins.deny.manifest is the revocation path: add an entry to stop trusting a hash, and remove the entry to restore trust.

Cutting a release

  1. Ensure that everything you want in the release is on master, that the previous release's trust-list pull request is merged, and that the normal pull request checks have passed.
  2. Verify that SIXLABORS_LICENSE_KEY and RELEASE_PR_TOKEN are present and current in the release environment, and that the repository SIXLABORS_LICENSE_KEY secret is current.
  3. Create the release/x.y.z branch from the current master as the owner. The publish job requires the branch to point at the current origin/master. The check is exact: if anything merges to master before the job runs, the job fails and the branch must be recreated from the new master.
  4. Approve the release environment for the publish and record-manifest jobs.
  5. Wait for Publish Release to publish and verify the official artifacts, record the trust list and build the release images.
  6. Download the release-api and release-web artifacts.
  7. Create the GitHub release and tag manually from those artifacts. The workflow does not create the release.
  8. Wait for Run All Tests and both branch validators on the other/record-release-1.2.3 pull request. Review the trust-list diff and merge it.
  9. The workflow builds the release images from the verified publish output to validate the image definitions, but it does not upload them. Build the images you ship from the downloaded artifacts, so they contain exactly the plugin binaries whose hashes were recorded:
    docker build -t nemera-api:1.2.3 -f src/Nemera.Presentation.Api/Dockerfile.release <release-api-directory>
    docker build -t nemera-web:1.2.3 -f src/Nemera.Presentation.Web/Dockerfile.release <release-web-directory>
    
    To publish, verify and build in one local step instead, run:
    dotnet msbuild build/build.proj -t:Docker -p:Configuration=Release -p:OfficialReleaseBuild=true -p:Version=1.2.3
    
    That target publishes from source, verifies the publish output and builds the images from it. Those images are not the exact released artifacts unless the build is byte-identical, so prefer the downloaded artifacts for the images you ship.

The local equivalent of the official build is verification only. Recording is CI-only. The release workflow checks that the checkout is clean and that HEAD matches origin/master exactly before it appends to the trust list.

dotnet msbuild build/build.proj -t:VerifyPublishedBundledPlugins -p:Configuration=Release -p:OfficialReleaseBuild=true

For a local Release build, set SixLaborsLicenseKey to the content of src/Nemera.Domain/sixlabors.lic first. The file alone is only discovered by Nemera.Domain, and projects that reference ImageSharp through it fail license validation otherwise.

Revoking a bundled plugin hash

The main trust list is append-only, so revoke a bad hash instead of removing it:

  1. Add a <assembly file name>|<SHA-256> line to build/BundledPlugins.deny.manifest.
  2. Merge the change to master.
  3. The next build embeds the deny list. The reader removes the hash from both the historical and the current trust lists, so a plugin with that hash is no longer marked Official. It still loads.

The deny list is intentionally not append-only. Remove the line to restore trust if the revocation was a mistake.

Rotating credentials

Six Labors license

When the license is renewed or replaced:

  1. Put the new value in the repository secret SIXLABORS_LICENSE_KEY used by Run All Tests.
  2. Put the same value in the environment secret SIXLABORS_LICENSE_KEY in the release environment.
  3. Re-run the failed workflow.

The local src/Nemera.Domain/sixlabors.lic file is only a local copy. Update it for local Release builds, but never commit it.

RELEASE_PR_TOKEN

When the token expires, is revoked or is compromised:

  1. Generate a new fine-grained token with the same repository access and permissions.
  2. Replace the RELEASE_PR_TOKEN environment secret in the release environment.
  3. Re-create the release branch or re-run the failed Publish Release workflow, depending on where it failed.
  4. Revoke the old token.

If the token is compromised, also review recent branches, pull requests and workflow runs. The token has only Contents and Pull requests write access to this repository.

Troubleshooting

Symptom Cause Fix
Publish Release does not run The created ref is not a release/x.y.z branch, or the actor is not the repository owner. Create the branch as the owner using the three-part version.
The workflow waits for approval The release environment has required reviewers. Approve the publish and record-manifest jobs as the owner.
No Six Labors license found The secret is missing or empty. Check the repository secret and the release environment secret.
Six Labors license expired The license key is no longer valid. Renew it, update both secrets and re-run.
git push or gh pr create fails with 401 or 403 RELEASE_PR_TOKEN is missing, expired or lacks Contents or Pull requests write, or the record-manifest checkout does not use it as the git token. Generate a new token if needed, update the environment secret, and ensure the record-manifest checkout passes it as token.
The trust-list pull request has no CI It was created with GITHUB_TOKEN instead of the PAT. Verify that the record-manifest job uses RELEASE_PR_TOKEN and that the secret is current.
A release branch is rejected by the ruleset The branch was not created by the owner. Create it as the owner. The bypass list must contain only the owner's account.
The branch validator rejects a release branch The branch is not release/x.y.z. Use three numeric parts, for example release/1.2.3.
The branch validator rejects the trust-list pull request The branch prefix is not allowed. The workflow uses other/record-release-x.y.z, which is allowed.
Official is false in a release The build did not use OfficialReleaseBuild=true, or the plugin binary does not match the trust manifest. Use the Publish Release workflow, or pass -p:OfficialReleaseBuild=true with Configuration=Release.
RecordBundledPlugins fails Recording is attempted outside GitHub Actions, from a dirty worktree, from a commit that is not the current origin/master, or without Configuration=Release and OfficialReleaseBuild=true. Use the Publish Release workflow. Commit or stash changes, merge the previous trust-list pull request, and recreate the release branch from master, if the guard reports a tree or history problem.
RecordBundledPlugins fails because master moved The release branch no longer matches the current origin/master. Recreate the release/x.y.z branch from the new master and approve the new run.
The record-list pull request removes trust-list lines The merge step was skipped, or master's current manifest was replaced with an older artifact. The record job only appends missing entries and fails if the staged diff removes a line. Rerun the workflow.
A known good plugin is not Official A deny-list entry matches its hash. Remove the matching line from build/BundledPlugins.deny.manifest.
VerifyPublishedBundledPlugins fails The manifest embedded in the published API assembly does not match the published plugin binaries. Re-run the release build from the same commit. Do not mix artifacts from different builds.
The release image build fails with an official configuration error Docker was called with OfficialReleaseBuild=true and a configuration other than Release. Pass -p:Configuration=Release.