name: publish-winui-exe on: workflow_dispatch: push: branches: - main - master tags: - "v*" permissions: contents: read packages: write jobs: publish: runs-on: windows-latest env: DOTNET_CLI_TELEMETRY_OPTOUT: "1" DOTNET_NOLOGO: "1" GITEA_PACKAGE_NAME: ymhut-box-winui GITEA_PACKAGE_OWNER: ${{ gitea.repository_owner }} GITEA_PACKAGE_SERVER_URL: ${{ gitea.server_url }} GITEA_PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} GITEA_PACKAGE_USERNAME: ${{ vars.PACKAGE_USERNAME }} steps: - name: Checkout uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x - name: Install Inno Setup compiler shell: pwsh run: | $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' $existing = Get-Command ISCC.exe -ErrorAction SilentlyContinue if ($existing) { Write-Host "ISCC already available: $($existing.Source)" exit 0 } $installer = Join-Path $env:RUNNER_TEMP 'innosetup-6.7.3.exe' Invoke-WebRequest ` -Uri 'https://github.com/jrsoftware/issrc/releases/download/is-6_7_3/innosetup-6.7.3.exe' ` -OutFile $installer Start-Process ` -FilePath $installer ` -ArgumentList '/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART', '/SP-' ` -Wait ` -PassThru | ForEach-Object { if ($_.ExitCode -ne 0) { throw "Inno Setup installer failed with exit code $($_.ExitCode)." } } $candidateRoots = @( "${env:ProgramFiles(x86)}\Inno Setup 6", "$env:ProgramFiles\Inno Setup 6", "${env:ProgramFiles(x86)}\Inno Setup 7", "$env:ProgramFiles\Inno Setup 7" ) $iscc = $candidateRoots | ForEach-Object { Join-Path $_ 'ISCC.exe' } | Where-Object { Test-Path -LiteralPath $_ } | Select-Object -First 1 if (-not $iscc) { throw 'Inno Setup compiler was installed, but ISCC.exe was not found.' } $isccRoot = Split-Path -Parent $iscc "YMHUT_INNO_SETUP=$isccRoot" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 "$isccRoot" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8 Write-Host "ISCC installed: $iscc" - name: Build EXE installer shell: pwsh run: .\scripts\build-winui.ps1 --target=exe --no-pause - name: Write installer checksum shell: pwsh run: | $ErrorActionPreference = 'Stop' $installer = Get-ChildItem -LiteralPath installer_output -Filter 'YMhut_Box_WinUI_Setup_*.exe' -File | Sort-Object LastWriteTime -Descending | Select-Object -First 1 if (-not $installer) { throw 'EXE installer was not produced.' } $hash = Get-FileHash -LiteralPath $installer.FullName -Algorithm SHA256 $checksumPath = "$($installer.FullName).sha256" $checksumLine = "$($hash.Hash.ToLowerInvariant()) $($installer.Name)" Set-Content -LiteralPath $checksumPath -Value $checksumLine -Encoding ASCII Write-Host "Installer: $($installer.FullName)" Write-Host "SHA256: $($hash.Hash.ToLowerInvariant())" - name: Publish to Gitea Packages shell: pwsh run: | $ErrorActionPreference = 'Stop' $installer = Get-ChildItem -LiteralPath installer_output -Filter 'YMhut_Box_WinUI_Setup_*.exe' -File | Sort-Object LastWriteTime -Descending | Select-Object -First 1 if (-not $installer) { throw 'EXE installer was not produced.' } $checksumPath = "$($installer.FullName).sha256" if (-not (Test-Path -LiteralPath $checksumPath)) { throw "Installer checksum was not produced: $checksumPath" } .\scripts\publish-gitea-generic-package.ps1 ` -ArtifactPath @($installer.FullName, $checksumPath) ` -Overwrite