|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, avnish/migrateWinUI ] |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +env: |
| 13 | + DOTNET_VERSION: '8.0.x' |
| 14 | + PROJECT_PATH: 'PingTool.WinUI3/PingTool.WinUI3.csproj' |
| 15 | + SOLUTION_PATH: 'PingTool.WinUI3.sln' |
| 16 | + |
| 17 | +jobs: |
| 18 | + build-msix-bundle: |
| 19 | + name: Build MSIX Bundle |
| 20 | + runs-on: windows-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Setup .NET |
| 29 | + uses: actions/setup-dotnet@v4 |
| 30 | + with: |
| 31 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 32 | + |
| 33 | + - name: Setup MSBuild |
| 34 | + uses: microsoft/setup-msbuild@v2 |
| 35 | + |
| 36 | + - name: Restore NuGet packages |
| 37 | + run: dotnet restore ${{ env.SOLUTION_PATH }} |
| 38 | + |
| 39 | + - name: Build MSIX Bundle |
| 40 | + run: | |
| 41 | + powershell -ExecutionPolicy Bypass -File .\BuildMsixBundle.ps1 |
| 42 | +
|
| 43 | + - name: Upload MSIX Bundle |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: msix-bundle |
| 47 | + path: PingTool.WinUI3/bin/Package/*.msixbundle |
| 48 | + retention-days: 30 |
| 49 | + |
| 50 | + - name: Upload MSIX Symbols |
| 51 | + uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: msix-symbols |
| 54 | + path: PingTool.WinUI3/bin/Package/**/*.msixsym |
| 55 | + retention-days: 30 |
| 56 | + |
| 57 | + build-installer: |
| 58 | + name: Build Traditional Installer |
| 59 | + runs-on: windows-latest |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Checkout code |
| 63 | + uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + fetch-depth: 0 |
| 66 | + |
| 67 | + - name: Setup .NET |
| 68 | + uses: actions/setup-dotnet@v4 |
| 69 | + with: |
| 70 | + dotnet-version: ${{ env.DOTNET_VERSION }} |
| 71 | + |
| 72 | + - name: Setup MSBuild |
| 73 | + uses: microsoft/setup-msbuild@v2 |
| 74 | + |
| 75 | + - name: Restore NuGet packages |
| 76 | + run: dotnet restore ${{ env.SOLUTION_PATH }} |
| 77 | + |
| 78 | + - name: Build x64 Release |
| 79 | + run: | |
| 80 | + msbuild ${{ env.PROJECT_PATH }} ` |
| 81 | + /p:Configuration=Release ` |
| 82 | + /p:Platform=x64 ` |
| 83 | + /p:WindowsPackageType=None ` |
| 84 | + /p:AppxPackageSigningEnabled=false ` |
| 85 | + /p:GenerateAppxPackageOnBuild=false ` |
| 86 | + /t:Restore,Build |
| 87 | +
|
| 88 | + - name: Publish x64 |
| 89 | + run: | |
| 90 | + dotnet publish ${{ env.PROJECT_PATH }} ` |
| 91 | + -c Release ` |
| 92 | + -r win-x64 ` |
| 93 | + --self-contained true ` |
| 94 | + /p:Platform=x64 ` |
| 95 | + /p:WindowsPackageType=None ` |
| 96 | + /p:PublishSingleFile=false ` |
| 97 | + /p:PublishReadyToRun=true ` |
| 98 | + /p:PublishTrimmed=false ` |
| 99 | + -o Output/Publish/win-x64 |
| 100 | +
|
| 101 | + - name: Setup Inno Setup |
| 102 | + run: | |
| 103 | + choco install innosetup -y |
| 104 | + |
| 105 | + - name: Create Installer |
| 106 | + run: | |
| 107 | + & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" InnoSetup.iss |
| 108 | +
|
| 109 | + - name: Upload Installer |
| 110 | + uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: installer |
| 113 | + path: Output/Installer/*.exe |
| 114 | + retention-days: 30 |
| 115 | + |
| 116 | + create-release: |
| 117 | + name: Create GitHub Release |
| 118 | + needs: [build-msix-bundle, build-installer] |
| 119 | + runs-on: windows-latest |
| 120 | + if: startsWith(github.ref, 'refs/tags/v') |
| 121 | + |
| 122 | + permissions: |
| 123 | + contents: write |
| 124 | + |
| 125 | + steps: |
| 126 | + - name: Checkout code |
| 127 | + uses: actions/checkout@v4 |
| 128 | + |
| 129 | + - name: Download MSIX Bundle |
| 130 | + uses: actions/download-artifact@v4 |
| 131 | + with: |
| 132 | + name: msix-bundle |
| 133 | + path: release/msix |
| 134 | + |
| 135 | + - name: Download Installer |
| 136 | + uses: actions/download-artifact@v4 |
| 137 | + with: |
| 138 | + name: installer |
| 139 | + path: release/installer |
| 140 | + |
| 141 | + - name: Get version from tag |
| 142 | + id: get_version |
| 143 | + run: | |
| 144 | + $version = "${{ github.ref_name }}".TrimStart('v') |
| 145 | + echo "VERSION=$version" >> $env:GITHUB_OUTPUT |
| 146 | + echo "Version: $version" |
| 147 | +
|
| 148 | + - name: Create Release Notes |
| 149 | + id: release_notes |
| 150 | + run: | |
| 151 | + $notes = @" |
| 152 | + ## Ping Legacy ${{ steps.get_version.outputs.VERSION }} |
| 153 | + |
| 154 | + ### Download Options |
| 155 | + |
| 156 | + **Microsoft Store (Recommended)** |
| 157 | + - Automatic updates |
| 158 | + - Sandboxed installation |
| 159 | + - [Get it from Microsoft Store](https://www.microsoft.com/store/apps/9NBLGGH4VQ4Q) |
| 160 | + |
| 161 | + **Direct Download** |
| 162 | + - Traditional installer |
| 163 | + - Offline installation |
| 164 | + - Download the .exe file below |
| 165 | + |
| 166 | + ### Installation Methods |
| 167 | + |
| 168 | + #### Method 1: Microsoft Store (Recommended) |
| 169 | + Get the app from the Microsoft Store for automatic updates and easy management. |
| 170 | + |
| 171 | + #### Method 2: MSIX Bundle |
| 172 | + - For IT administrators or sideloading |
| 173 | + - Requires certificate installation |
| 174 | + - Download the .msixbundle file |
| 175 | + |
| 176 | + #### Method 3: Traditional Installer |
| 177 | + - Standard Windows installer |
| 178 | + - Download the .exe file |
| 179 | + - Requires .NET 8 Desktop Runtime |
| 180 | + |
| 181 | + ### System Requirements |
| 182 | + - Windows 10 version 1809 (Build 17763) or later |
| 183 | + - Windows 11 (all versions) |
| 184 | + - .NET 8 Desktop Runtime (will be prompted to install if missing) |
| 185 | + |
| 186 | + ### What's New |
| 187 | + - See CHANGELOG.md for details |
| 188 | + |
| 189 | + ### Known Issues |
| 190 | + - See GitHub Issues for current known issues |
| 191 | + "@ |
| 192 | + |
| 193 | + $notes | Out-File -FilePath release_notes.md -Encoding utf8 |
| 194 | + echo "NOTES_FILE=release_notes.md" >> $env:GITHUB_OUTPUT |
| 195 | +
|
| 196 | + - name: Create GitHub Release |
| 197 | + uses: softprops/action-gh-release@v1 |
| 198 | + with: |
| 199 | + name: Ping Legacy ${{ steps.get_version.outputs.VERSION }} |
| 200 | + body_path: ${{ steps.release_notes.outputs.NOTES_FILE }} |
| 201 | + draft: false |
| 202 | + prerelease: false |
| 203 | + files: | |
| 204 | + release/msix/*.msixbundle |
| 205 | + release/installer/*.exe |
| 206 | + env: |
| 207 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 208 | + |
| 209 | + test-installer: |
| 210 | + name: Test Installer |
| 211 | + needs: [build-installer] |
| 212 | + runs-on: windows-latest |
| 213 | + |
| 214 | + steps: |
| 215 | + - name: Download Installer |
| 216 | + uses: actions/download-artifact@v4 |
| 217 | + with: |
| 218 | + name: installer |
| 219 | + path: installer |
| 220 | + |
| 221 | + - name: List installer files |
| 222 | + run: | |
| 223 | + Get-ChildItem -Path installer -Recurse |
| 224 | +
|
| 225 | + - name: Verify installer exists |
| 226 | + run: | |
| 227 | + $installer = Get-ChildItem -Path installer -Filter "*.exe" | Select-Object -First 1 |
| 228 | + if ($installer) { |
| 229 | + Write-Host "? Installer found: $($installer.Name)" |
| 230 | + Write-Host " Size: $([math]::Round($installer.Length / 1MB, 2)) MB" |
| 231 | + } else { |
| 232 | + Write-Error "? No installer found!" |
| 233 | + exit 1 |
| 234 | + } |
| 235 | +
|
| 236 | + # Note: Actual installation test would require a clean VM |
| 237 | + # This is a basic verification that the installer was built |
0 commit comments