Build Windows EXE on Ubuntu runner
All checks were successful
Build MrTrust / build (push) Successful in 1m37s

This commit is contained in:
MrSphay
2026-05-16 00:03:58 +02:00
parent 319ea1ca8d
commit 46026cb62c
4 changed files with 50 additions and 24 deletions

View File

@@ -8,39 +8,52 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
build-windows: build:
runs-on: windows-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Verify PowerShell scripts - name: Setup .NET
shell: powershell uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Build Windows EXE
shell: bash
run: | run: |
$scripts = @() set -euo pipefail
$scripts += @(Get-ChildItem . -Filter *.ps1) dotnet publish src/MrTrustLauncher.csproj \
$scripts += @(Get-ChildItem .\scripts -Filter *.ps1) --configuration Release \
foreach ($script in $scripts) { --runtime win-x64 \
$tokens = $null --output dist/build \
$errors = $null -p:EnableWindowsTargeting=true \
[System.Management.Automation.Language.Parser]::ParseFile($script.FullName, [ref]$tokens, [ref]$errors) | Out-Null -p:PublishSingleFile=true \
if ($errors) { throw $errors } -p:SelfContained=false
} cp dist/build/MrTrust.exe dist/MrTrust.exe
- name: Build release ZIP - name: Build release ZIP
shell: powershell shell: bash
run: | run: |
$arguments = @("-ExecutionPolicy", "Bypass", "-File", ".\scripts\New-MrTrustRelease.ps1", "-Version", "0.1.0") set -euo pipefail
if ($env:MRTRUST_SIGNING_THUMBPRINT) { version="0.1.0"
$arguments += @("-SigningThumbprint", $env:MRTRUST_SIGNING_THUMBPRINT) package_root="dist/MrTrust-${version}"
} rm -rf "$package_root" "dist/MrTrust-${version}.zip"
powershell @arguments mkdir -p "$package_root/scripts" "$package_root/assets/certificates" "$package_root/docs"
cp dist/MrTrust.exe "$package_root/"
cp MrTrust.ps1 README.md "$package_root/"
cp scripts/Install-MrTrust.ps1 scripts/Uninstall-MrTrust.ps1 scripts/Start-MrTrustGui.ps1 "$package_root/scripts/"
cp assets/certificates/MrSphay-LocalTrust-Root.cer "$package_root/assets/certificates/"
cp assets/certificates/MrSphay-CodeSigning.cer "$package_root/assets/certificates/"
cp assets/certificates/thumbprints.txt "$package_root/assets/certificates/"
cp docs/security-model.md "$package_root/docs/"
(cd dist && zip -r "MrTrust-${version}.zip" "MrTrust-${version}")
- name: Show package contents - name: Show package contents
shell: powershell shell: bash
run: | run: |
Get-ChildItem .\dist -Recurse | Select-Object FullName, Length find dist -maxdepth 4 -type f -printf '%p %s bytes\n'
- name: Upload release artifact - name: Upload release artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

View File

@@ -4,6 +4,6 @@
- Added MrTrust certificate generation, installation, removal, and signing scripts. - Added MrTrust certificate generation, installation, removal, and signing scripts.
- Added a simple Windows GUI for installing and removing MrTrust. - Added a simple Windows GUI for installing and removing MrTrust.
- Added a Windows launcher EXE and Gitea Runner workflow for release ZIP builds. - Added a Windows launcher EXE and Ubuntu Gitea Runner workflow for release ZIP builds.
- Added integration prompt for other Windows projects. - Added integration prompt for other Windows projects.
- Added security model documentation. - Added security model documentation.

View File

@@ -68,8 +68,7 @@ Build a user-facing ZIP release:
.\scripts\New-MrTrustRelease.ps1 -Version 0.1.0 .\scripts\New-MrTrustRelease.ps1 -Version 0.1.0
``` ```
The Gitea workflow `.gitea/workflows/build.yml` builds the same ZIP on a Windows runner and uploads it as an artifact. The Gitea workflow `.gitea/workflows/build.yml` builds the Windows launcher EXE on an `ubuntu-latest` runner with .NET Windows cross-targeting, then uploads the ZIP as an artifact.
If the Windows runner has the private signing certificate installed, set `MRTRUST_SIGNING_THUMBPRINT` to sign the launcher during the build.
## User Installation ## User Installation

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<AssemblyName>MrTrust</AssemblyName>
<RootNamespace>MrTrust</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>