mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
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
This commit is contained in:
1 parent
3fb8912c7f
commit
b30cbd6b9e
114 files changed
+2708
-243
No files matched your search
@@ -0,0 +1,153 @@
|
||||
name: Publish Release
|
||||
|
||||
# Runs only when the repository owner creates a release/x.y.z branch. The protected "release" environment supplies the Six Labors license and the pull request token, and requires approval.
|
||||
# The repository ruleset restricts who can create release branches.
|
||||
|
||||
on:
|
||||
create:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
if: github.event.ref_type == 'branch' && startsWith(github.ref_name, 'release/') && github.actor == github.repository_owner
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
environment: release
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
fetch-depth: 0
|
||||
- name: Validate release branch name
|
||||
env:
|
||||
RELEASE_BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
if [[ ! "$RELEASE_BRANCH" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Invalid release branch name. Use release/x.y.z." >&2
|
||||
exit 1
|
||||
fi
|
||||
- name: Fetch master for the recording guard
|
||||
run: git fetch --no-tags origin master:refs/remotes/origin/master
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '10.0.100'
|
||||
- name: Restore Six Labors license
|
||||
shell: bash
|
||||
env:
|
||||
SIXLABORS_LICENSE_KEY: ${{ secrets.SIXLABORS_LICENSE_KEY }}
|
||||
run: printf '%s\n' "$SIXLABORS_LICENSE_KEY" > src/Nemera.Domain/sixlabors.lic
|
||||
- name: Publish, verify, and record official release
|
||||
env:
|
||||
SixLaborsLicenseKey: ${{ secrets.SIXLABORS_LICENSE_KEY }}
|
||||
RELEASE_BRANCH: ${{ github.ref_name }}
|
||||
run: dotnet msbuild build/build.proj -t:RecordBundledPlugins -p:Configuration=Release -p:OfficialReleaseBuild=true -p:AllowBundledPluginsRecording=true -p:ReleaseBranch="$RELEASE_BRANCH"
|
||||
# Reuse the verified publish output, so the images contain exactly the plugin binaries whose hashes were recorded.
|
||||
- name: Build release images
|
||||
env:
|
||||
RELEASE_BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
release_version="${RELEASE_BRANCH#release/}"
|
||||
dotnet msbuild build/build.proj -t:Docker -p:Configuration=Release -p:OfficialReleaseBuild=true -p:ReusePublishedBundledPlugins=true -p:Version="$release_version"
|
||||
- name: Upload release server files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-api
|
||||
path: bin/api/publish
|
||||
if-no-files-found: error
|
||||
- name: Upload release web files
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-web
|
||||
path: bin/web/publish
|
||||
if-no-files-found: error
|
||||
- name: Upload bundled plugin manifest
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: bundled-plugins-manifest
|
||||
path: build/BundledPlugins.manifest
|
||||
if-no-files-found: error
|
||||
|
||||
# The record job runs separately because it needs the pull request token to write to master, while the publish job stays read-only.
|
||||
record-manifest:
|
||||
needs: publish
|
||||
runs-on: ubuntu-latest
|
||||
environment: release
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
# Use the PAT rather than GITHUB_TOKEN, so the pull request opened below triggers the normal CI workflows.
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.RELEASE_PR_TOKEN }}
|
||||
- name: Validate release branch name
|
||||
env:
|
||||
RELEASE_BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
if [[ ! "$RELEASE_BRANCH" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Invalid release branch name. Use release/x.y.z." >&2
|
||||
exit 1
|
||||
fi
|
||||
- name: Download bundled plugin manifest
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: bundled-plugins-manifest
|
||||
path: recorded-manifest
|
||||
# Merge into master's current file instead of overwriting it, so hashes recorded by earlier releases survive when master advanced after this branch was cut.
|
||||
- name: Merge the released manifest into master
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from pathlib import Path
|
||||
|
||||
master_path = Path("build/BundledPlugins.manifest")
|
||||
artifact_path = Path("recorded-manifest/BundledPlugins.manifest")
|
||||
master_text = master_path.read_text()
|
||||
existing_entries = {
|
||||
line.strip().lower()
|
||||
for line in master_text.splitlines()
|
||||
if line.strip() and not line.strip().startswith("#")
|
||||
}
|
||||
new_entries = []
|
||||
for line in artifact_path.read_text().splitlines():
|
||||
entry = line.strip()
|
||||
if not entry or entry.startswith("#") or entry.lower() in existing_entries:
|
||||
continue
|
||||
existing_entries.add(entry.lower())
|
||||
new_entries.append(entry)
|
||||
if new_entries:
|
||||
separator = "" if master_text.endswith("\n") else "\n"
|
||||
master_path.write_text(master_text + separator + "\n".join(new_entries) + "\n")
|
||||
PY
|
||||
- name: Create record-release pull request
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }}
|
||||
RELEASE_BRANCH: ${{ github.ref_name }}
|
||||
run: |
|
||||
release_version="${RELEASE_BRANCH#release/}"
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
branch="other/record-release-$release_version"
|
||||
git checkout -b "$branch"
|
||||
git add build/BundledPlugins.manifest
|
||||
# The list is append-only. Fail loudly if a merge or a rerun staged a deletion instead of relying on review to catch it.
|
||||
if [[ -n "$(git diff --cached --numstat -- build/BundledPlugins.manifest | awk '$2 != 0')" ]]; then
|
||||
echo "The bundled plugin trust manifest diff removes lines. The list is append-only." >&2
|
||||
exit 1
|
||||
fi
|
||||
if git diff --cached --quiet; then
|
||||
echo "The bundled plugin manifest is already up to date."
|
||||
exit 0
|
||||
fi
|
||||
git commit -m "Records bundled plugin hashes for $release_version"
|
||||
git push --force-with-lease --set-upstream origin "$branch"
|
||||
gh pr create \
|
||||
--base master \
|
||||
--head "$branch" \
|
||||
--title "Records bundled plugin hashes for $release_version" \
|
||||
--body "This pull request records the published plugin hashes of the $release_version release in the bundled plugin trust list. The release artifacts already embed the current release's official plugin manifest. Merge this pull request to keep the $release_version plugin binaries Official in future releases. Run All Tests and the branch validators should pass before merging."
|
||||
@@ -14,11 +14,11 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
dotnet-version: '10.0.100'
|
||||
- name: Raise file watcher limits
|
||||
# The test hosts create a Razor file watcher per static asset, and the default limit of 128 inotify instances
|
||||
# is reached when several hosts run in parallel.
|
||||
@@ -26,7 +26,9 @@ jobs:
|
||||
run: sudo sysctl -w fs.inotify.max_user_instances=1024 fs.inotify.max_user_watches=524288
|
||||
- name: Restore Six Labors license
|
||||
shell: bash
|
||||
run: printf '%s\n' "${{ secrets.SIXLABORS_LICENSE_KEY }}" > src/Nemera.Domain/sixlabors.lic
|
||||
env:
|
||||
SIXLABORS_LICENSE_KEY: ${{ secrets.SIXLABORS_LICENSE_KEY }}
|
||||
run: printf '%s\n' "$SIXLABORS_LICENSE_KEY" > src/Nemera.Domain/sixlabors.lic
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore src/Nemera.slnx
|
||||
- name: Build
|
||||
|
||||
@@ -10,15 +10,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check branch name
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.ref_name }}
|
||||
run: |
|
||||
branch_name=${{ github.ref_name }}
|
||||
if [[ $branch_name == "master" ]]; then
|
||||
branch_name="$BRANCH_NAME"
|
||||
if [[ "$branch_name" == "master" ]]; then
|
||||
echo "Branch is master, skipping check."
|
||||
exit 0
|
||||
fi
|
||||
if ! [[ $branch_name =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then
|
||||
if [[ "$branch_name" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Branch name '$branch_name' follows the release naming convention."
|
||||
exit 0
|
||||
fi
|
||||
if ! [[ "$branch_name" =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then
|
||||
echo "Branch name '$branch_name' does not follow the naming convention."
|
||||
echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, or other/"
|
||||
echo "Example: feature/my-feature-name or bugfix/fix-issue-123"
|
||||
echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, other/, or be a release/x.y.z branch."
|
||||
echo "Example: feature/my-feature-name, bugfix/fix-issue-123, or release/1.2.3"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -10,11 +10,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check source branch name
|
||||
env:
|
||||
BRANCH_NAME: ${{ github.head_ref }}
|
||||
run: |
|
||||
branch_name=${{ github.head_ref }}
|
||||
if ! [[ $branch_name =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then
|
||||
branch_name="$BRANCH_NAME"
|
||||
if [[ "$branch_name" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Branch name '$branch_name' follows the release naming convention."
|
||||
exit 0
|
||||
fi
|
||||
if ! [[ "$branch_name" =~ ^(feature|bugfix|hotfix|documentation|refactor|other)/ ]]; then
|
||||
echo "Error: Branch name '$branch_name' does not follow the naming convention."
|
||||
echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, or other/"
|
||||
echo "It should start with one of: feature/, bugfix/, hotfix/, documentation/, refactor/, other/, or be a release/x.y.z branch."
|
||||
exit 1
|
||||
fi
|
||||
echo "Branch name '$branch_name' follows the correct naming convention."
|
||||
echo "Branch name '$branch_name' follows the correct naming convention."
|
||||
Reference in new issue
Block a user