mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
Adds per-platform release artifacts and release image validation
This commit is contained in:
1 parent
92ab62011e
commit
68143dff25
19 files changed
+603
-115
No files matched your search
@@ -30,7 +30,7 @@ Everything from Configuration onward applies to whichever route you chose.
|
||||
|
||||
## Before you start
|
||||
|
||||
- **Docker**, if you want the container route. For a non-container install, you need the Nemera application files, from a release package or installer, or from your own build, plus the **.NET 10 runtime** unless that package is self-contained. The **.NET 10 SDK** is only needed if you build from source.
|
||||
- **Docker**, if you want the container route. For a non-container install, you need the Nemera application files, from a release package or installer, or from your own build, plus the **ASP.NET Core Runtime 10** unless that package is self-contained. The **.NET 10 SDK** is only needed if you build from source.
|
||||
- **ffmpeg**, for any non-container install, however you obtained the application files. The API server uses it to remux or transcode audio that the browser cannot play as stored. The Docker API container image already includes it.
|
||||
- By default the **web client listens on port `5012`** and the **API on port `5214`**. You can change either, as long as the two agree on where the API is (see [Configuration](#configuration)).
|
||||
- For anything reachable beyond your own machine, put a **reverse proxy** in front to terminate TLS and forward to the web client.
|
||||
@@ -86,12 +86,25 @@ Use a release package or installer when one is available, or, with the .NET 10 S
|
||||
dotnet build Nemera.slnx
|
||||
```
|
||||
|
||||
The official release artifacts include the PDF plugin's native libraries for Linux x64 and ARM64 (including Alpine x64), macOS Intel and Apple Silicon, and Windows x64 and ARM64. The single release download works on those platforms; the plugin loads the native libraries that match the host at runtime.
|
||||
The official release is split into one API archive and one web archive per platform and architecture. Download both archives for your platform:
|
||||
|
||||
Run the API and the web client from the installed release package or from the published build. In development, their addresses come from each project's `launchSettings.json` (`http://localhost:5214` and `http://localhost:5012`). When you run a published build directly on a host, set the addresses yourself, either with `ASPNETCORE_URLS` or with `ASPNETCORE_HTTP_PORTS`:
|
||||
| Platform | API archive | Web archive |
|
||||
| --- | --- | --- |
|
||||
| Linux x64 | `Nemera-<version>-linux-x64-api.tar.gz` | `Nemera-<version>-linux-x64-web.tar.gz` |
|
||||
| Linux ARM64 | `Nemera-<version>-linux-arm64-api.tar.gz` | `Nemera-<version>-linux-arm64-web.tar.gz` |
|
||||
| Linux x64 with musl, including Alpine | `Nemera-<version>-linux-musl-x64-api.tar.gz` | `Nemera-<version>-linux-musl-x64-web.tar.gz` |
|
||||
| macOS Intel | `Nemera-<version>-macos-x64-api.tar.gz` | `Nemera-<version>-macos-x64-web.tar.gz` |
|
||||
| macOS Apple Silicon | `Nemera-<version>-macos-arm64-api.tar.gz` | `Nemera-<version>-macos-arm64-web.tar.gz` |
|
||||
| Windows x64 | `Nemera-<version>-windows-x64-api.zip` | `Nemera-<version>-windows-x64-web.zip` |
|
||||
| Windows x86 | `Nemera-<version>-windows-x86-api.zip` | `Nemera-<version>-windows-x86-web.zip` |
|
||||
| Windows ARM64 | `Nemera-<version>-windows-arm64-api.zip` | `Nemera-<version>-windows-arm64-web.zip` |
|
||||
|
||||
Each archive contains only the files for its platform and architecture. The API archive includes the bundled plugins and the PDF plugin's native libraries for that platform. Extract both archives into separate folders.
|
||||
|
||||
When using the release package, run the API and the web client from the folders you extracted. On Windows, start `Nemera.Presentation.Api.exe` and `Nemera.Presentation.Web.exe`. On Linux and macOS, start `./Nemera.Presentation.Api` and `./Nemera.Presentation.Web`. The API listens on `http://localhost:5214` and the web client on `http://localhost:5012` by default. Set `ASPNETCORE_URLS`, `ASPNETCORE_HTTP_PORTS` or `ASPNETCORE_HTTPS_PORTS` only when you need different addresses:
|
||||
|
||||
```bash
|
||||
ASPNETCORE_HTTP_PORTS=5012 dotnet Nemera.Presentation.Web.dll
|
||||
ASPNETCORE_URLS=http://0.0.0.0:5012 ./Nemera.Presentation.Web
|
||||
```
|
||||
|
||||
The API creates its SQLite database (`Nemera.db`) next to its own binary and applies any pending migrations at startup, so the first launch sets up the schema on its own.
|
||||
|
||||
+23
-15
@@ -19,15 +19,17 @@ Releases are cut only by the repository owner. There is one official build, and
|
||||
|
||||
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.
|
||||
3. The same workflow verifies the embedded plugin manifest against every published API folder, 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 release archives 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 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 embedded plugin manifest against every published API folder, checks the native folders and files of every runtime, verifies every archive against its publish folder, 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 `Publish` target produces two archives for each supported runtime identifier: an API archive and a web archive. The names are `Nemera-<version>-<platform>-<architecture>-api.<extension>` and `Nemera-<version>-<platform>-<architecture>-web.<extension>`, for example `Nemera-1.2.3-linux-x64-web.tar.gz` and `Nemera-1.2.3-windows-x64-api.zip`. Windows archives are `.zip` files; Linux and macOS archives are `.tar.gz` files, so the executable permission survives the download. Each archive contains the application files, the native apphost and the native libraries for that runtime identifier only. The supported runtime identifiers are `linux-x64`, `linux-arm64`, `linux-musl-x64`, `osx-x64`, `osx-arm64`, `win-x64`, `win-x86` and `win-arm64`, and the workflow builds them all on `ubuntu-latest`. The API archive also contains the bundled plugins, so the API can run directly from the extracted folder. The plugin deployment copies only the native runtime folders the catalog declares for that runtime: the identifier's own folder and the shared `osx` folder for the macOS archives, so the PDF plugin's native libraries for the other operating systems are not shipped. The macOS archives keep their shared SkiaSharp library in the `osx` fallback folder, which the build retains automatically even though no device reports that identifier. The runtime list is defined by the `BundledPluginRuntime` items and the native folder mapping by `BundledPluginRuntimeDirectory` in `build/RuntimeIdentifiers.props`. The catalog must list exactly the folders the bundled plugins deploy: verification fails when the staging folder is missing a declared folder or contains an undeclared one, and each release must contain exactly the folders declared for its runtime identifier. 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. Verification runs the embedded manifest test against every published API folder, requires exactly the declared native runtime folders and their files, and extracts every archive to compare its contents and hashes with the publish folder it was built from. The trust list records the published plugin hashes from the verified `linux-x64` folder; every other runtime folder is verified against the same embedded manifest and its plugin binaries are compared with that reference folder, so the recorded hashes describe every shipped platform. The publish output excludes `.pdb` files. The API listens on `http://localhost:5214` and the web client on `http://localhost:5012` by default. The `Publish Release` workflow builds the release images from the `linux-x64` publish folders to validate the image definitions, and does not upload them. The images you ship are built manually from the extracted `Nemera-<version>-linux-x64-api` and `Nemera-<version>-linux-x64-web` archives with `--platform linux/amd64`, or from the `linux-arm64` archives with `--platform linux/arm64`; the `linux-musl-x64` archives cannot be used with these images, because their base image is a glibc distribution. The Linux and macOS archives must be created on Linux or macOS, because Windows cannot store the executable bit in a tar archive: `Publish` on Windows creates only the Windows archives and warns that the others were skipped.
|
||||
|
||||
`Publish` restores the API and web projects once for all supported runtimes and publishes each runtime with `--no-restore`, so the projects keep a multi-RID assets file. The restore reads the runtime list from an environment variable set only for that command, so normal builds are unaffected.
|
||||
|
||||
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.
|
||||
|
||||
@@ -93,12 +95,12 @@ The token is used only by the `record-manifest` job. It is not available to the
|
||||
## 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.
|
||||
- `publish`: builds and publishes the official artifacts with `OfficialReleaseBuild=true`, runs the manifest verification tests, verifies the embedded plugin manifest against every published API folder, checks every runtime's native folders and files, verifies every archive against its publish folder, records the released plugin hashes, builds the release images from the verified publish output, and uploads the `release-archives` and `bundled-plugins-manifest` artifacts. The `release-archives` artifact contains the API and web archives for every supported runtime. 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.
|
||||
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 embedded plugin manifest against every published API folder, the native folders and files of every runtime, and the contents of every archive 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.
|
||||
|
||||
@@ -111,26 +113,29 @@ The trust list `build/BundledPlugins.manifest` is append-only. Never remove exis
|
||||
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.
|
||||
6. Download the `release-archives` artifact. It contains one API archive and one web archive for each supported runtime identifier.
|
||||
7. Create the GitHub release and tag manually from those archives. 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:
|
||||
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 extracted archives, so they contain exactly the plugin binaries whose hashes were recorded:
|
||||
```bash
|
||||
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>
|
||||
docker build --platform linux/amd64 -t nemera-api:1.2.3 -f src/Nemera.Presentation.Api/Dockerfile.release <extracted-api-folder>
|
||||
docker build --platform linux/amd64 -t nemera-web:1.2.3 -f src/Nemera.Presentation.Web/Dockerfile.release <extracted-web-folder>
|
||||
```
|
||||
Extract `Nemera-1.2.3-linux-x64-api.tar.gz` and `Nemera-1.2.3-linux-x64-web.tar.gz` first. Each archive contains its publish files at the root, so the extracted folder is the Docker context. Use `--platform linux/arm64` with the `linux-arm64` archives. The `linux-musl-x64` archives cannot be used with these images, because their base image is a glibc distribution.
|
||||
To publish, verify and build in one local step instead, run:
|
||||
```bash
|
||||
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.
|
||||
That target publishes from source, verifies the publish output and builds the images from the `linux-x64` publish folder with the `linux/amd64` platform derived from `ApiReleaseRuntimeIdentifier`. Pass `-p:ApiReleaseRuntimeIdentifier=linux-arm64` to build from the arm64 publish folder instead. Those images are not the exact released artifacts unless the build is byte-identical, so prefer the downloaded archives 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.
|
||||
|
||||
```bash
|
||||
dotnet msbuild build/build.proj -t:VerifyPublishedBundledPlugins -p:Configuration=Release -p:OfficialReleaseBuild=true
|
||||
dotnet msbuild build/build.proj -t:VerifyPublishedBundledPlugins -p:Configuration=Release -p:OfficialReleaseBuild=true -p:Version=1.2.3
|
||||
```
|
||||
|
||||
`VerifyPublishedBundledPlugins` checks the publish folders and does not require `bin/release`. `CreateReleaseArchives` can run on its own after a publish, and `VerifyReleaseArchives` creates the archives if needed and verifies every archive against its publish folder; both must run on Linux or macOS, because Windows cannot create `.tar.gz` archives with the executable bit. The Docker target only needs the publish folders, so `-t:Docker -p:ReusePublishedBundledPlugins=true` works even when `bin/release` is absent. `ReusePublishedBundledPlugins=true` skips both the publish and its verification, so pass it only after the publish folders were just verified, as the release workflow does. The release Docker target derives `--platform` from `ApiReleaseRuntimeIdentifier`, which must be `linux-x64` (`linux/amd64`) or `linux-arm64` (`linux/arm64`); `linux-musl-x64` has no matching glibc image base.
|
||||
|
||||
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
|
||||
@@ -184,5 +189,8 @@ If the token is compromised, also review recent branches, pull requests and work
|
||||
| `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`. |
|
||||
| `VerifyPublishedBundledPlugins` fails | The bundled plugin staging folder is missing a native folder the catalog declares or contains an undeclared one, a published runtime folder is missing its assembly, apphost, plugin binary or native file, still contains a PDB or an undeclared native runtime folder or an unexpected number of plugin binaries, its embedded plugin manifest does not match its plugin binaries, or its plugin binaries differ from the reference `linux-x64` folder. | Re-run the release build from the same commit. Do not mix artifacts from different builds. If the staging folder and the catalog disagree, align `build/RuntimeIdentifiers.props` with the native folders the bundled plugins deploy. |
|
||||
| `VerifyReleaseArchives` fails | A platform archive is missing, or its files or hashes differ from the publish folder it was built from, or the Linux or macOS app host is not executable inside the archive. | Re-run the release build from the same commit, so the archives and the publish folders come from the same build. Build Linux and macOS archives on Linux or macOS. |
|
||||
| The Linux or macOS archives are missing after `Publish` | `Publish` ran on Windows, which cannot store the executable bit in a tar archive, so those archives are skipped with a warning. | Run `Publish` on Linux or macOS. The `Publish Release` workflow builds the released archives on `ubuntu-latest`. |
|
||||
| The release build rejects the version | `Version` or `ReleaseVersion` is not three numeric parts. | Pass a version such as `-p:Version=1.2.3`. |
|
||||
| The release image build fails with an official configuration error | `Docker` was called with `OfficialReleaseBuild=true` and a configuration other than `Release`, or with an `ApiReleaseRuntimeIdentifier` that is not a glibc runtime (`linux-x64` or `linux-arm64`; the musl runtime has no matching image base). | Pass `-p:Configuration=Release` and a glibc runtime identifier such as `linux-x64`. |
|
||||
Reference in new issue
Block a user