Skip to content

Rename shipped app to SimpleOps and harden desktop GSX voice controller #4

Rename shipped app to SimpleOps and harden desktop GSX voice controller

Rename shipped app to SimpleOps and harden desktop GSX voice controller #4

name: Windows Desktop Build
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: write
env:
PROJECT_FILE: SimpleOps.GsxRamp.csproj
CONFIGURATION: Release
PLATFORM: x64
EXE_PATH: bin\Release\SimpleOps.exe
ZIP_NAME: SimpleOPS-windows-x64.zip
jobs:
build-test-package:
name: Build, test, package
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v3
with:
msbuild-architecture: x64
- name: Build SimpleOPS
shell: pwsh
run: |
msbuild $env:PROJECT_FILE `
/t:Clean,Build `
/p:Configuration=$env:CONFIGURATION `
/p:Platform=$env:PLATFORM `
/p:PlatformTarget=x64 `
/p:UseSharedCompilation=false `
/m
- name: Run parser tests
shell: pwsh
run: |
& $env:EXE_PATH --run-parser-tests
- name: Run dry-run smoke test
shell: pwsh
run: |
& $env:EXE_PATH --no-speech --no-voice --dry-run --run-duration-seconds 1
# Optional signing.
# This only runs if you add WINDOWS_SIGNING_CERT_BASE64 as a GitHub secret.
- name: Sign executable
if: ${{ env.WINDOWS_SIGNING_CERT_BASE64 != '' }}
shell: pwsh
env:
WINDOWS_SIGNING_CERT_BASE64: ${{ secrets.WINDOWS_SIGNING_CERT_BASE64 }}
WINDOWS_SIGNING_CERT_PASSWORD: ${{ secrets.WINDOWS_SIGNING_CERT_PASSWORD }}
run: |
$certPath = "$env:RUNNER_TEMP\codesign.pfx"
[IO.File]::WriteAllBytes(
$certPath,
[Convert]::FromBase64String($env:WINDOWS_SIGNING_CERT_BASE64)
)
$signtool = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin" `
-Recurse `
-Filter signtool.exe |
Where-Object { $_.FullName -like "*\x64\signtool.exe" } |
Sort-Object FullName -Descending |
Select-Object -First 1
if (-not $signtool) {
throw "signtool.exe was not found."
}
& $signtool.FullName sign `
/f $certPath `
/p $env:WINDOWS_SIGNING_CERT_PASSWORD `
/fd SHA256 `
/td SHA256 `
/tr http://timestamp.digicert.com `
$env:EXE_PATH
& $signtool.FullName verify /pa /v $env:EXE_PATH
- name: Package app
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist\package | Out-Null
Copy-Item $env:EXE_PATH dist\package\
Copy-Item bin\Release\*.dll dist\package\ -ErrorAction Stop
Copy-Item README.md dist\package\ -ErrorAction SilentlyContinue
Copy-Item license.md dist\package\ -ErrorAction SilentlyContinue
@(
'SimpleOps.exe',
'Microsoft.FlightSimulator.SimConnect.dll',
'SimConnect.dll',
'NAudio.dll',
'NAudio.Core.dll',
'NAudio.Wasapi.dll',
'NAudio.WinMM.dll'
) | ForEach-Object {
if (-not (Test-Path (Join-Path 'dist\\package' $_))) {
throw "Missing packaged dependency: $_"
}
}
Compress-Archive `
-Path dist\package\* `
-DestinationPath "dist\$env:ZIP_NAME" `
-Force
- name: Upload workflow artifact
uses: actions/upload-artifact@v4
with:
name: SimpleOPS-windows-x64
path: dist/${{ env.ZIP_NAME }}
retention-days: 14
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create $env:GITHUB_REF_NAME `
"dist\$env:ZIP_NAME#SimpleOPS Windows x64" `
--title "SimpleOPS $env:GITHUB_REF_NAME" `
--generate-notes