fix: update script #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| VERSION: '' # Will be set from package.json | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version from package.json | |
| id: get_version | |
| shell: pwsh | |
| run: | | |
| $packageJson = Get-Content -Path "package.json" -Raw | ConvertFrom-Json | |
| $version = $packageJson.version | |
| Write-Host "Version from package.json: $version" | |
| echo "VERSION=$version" >> $env:GITHUB_ENV | |
| echo "version=$version" >> $env:GITHUB_OUTPUT | |
| - name: Setup .NET 8 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Install WiX Toolset | |
| shell: pwsh | |
| run: | | |
| dotnet tool install --global wix --version 4.0.5 | |
| wix --version | |
| - name: Restore dependencies | |
| run: | | |
| dotnet restore Src/GhostDraw/GhostDraw.csproj | |
| dotnet restore Tests/GhostDraw.Tests/GhostDraw.Tests.csproj | |
| - name: Build application and tests | |
| run: | | |
| dotnet build Src/GhostDraw/GhostDraw.csproj -c Release --no-restore | |
| dotnet build Tests/GhostDraw.Tests/GhostDraw.Tests.csproj -c Release --no-restore | |
| - name: Run tests | |
| run: dotnet test Tests/GhostDraw.Tests/GhostDraw.Tests.csproj -c Release --no-build --verbosity normal | |
| - name: Publish application | |
| shell: pwsh | |
| run: | | |
| dotnet publish Src/GhostDraw/GhostDraw.csproj ` | |
| -c Release ` | |
| -r win-x64 ` | |
| --self-contained true ` | |
| -p:PublishSingleFile=false ` | |
| -p:Version=${{ env.VERSION }} | |
| - name: Generate WiX component list | |
| shell: pwsh | |
| working-directory: Installer | |
| run: | | |
| .\Generate-FileList.ps1 ` | |
| -PublishPath "..\Src\GhostDraw\bin\Release\net8.0-windows\win-x64\publish" ` | |
| -OutputFile "HarvestedFiles.wxs" | |
| - name: Build installer MSI | |
| shell: pwsh | |
| working-directory: Installer | |
| run: | | |
| dotnet build GhostDraw.Installer.wixproj ` | |
| -c Release ` | |
| -p:Version=${{ env.VERSION }} ` | |
| -p:PublishDir="..\Src\GhostDraw\bin\Release\net8.0-windows\win-x64\publish\" | |
| - name: Verify build outputs | |
| shell: pwsh | |
| run: | | |
| $exePath = "Src\GhostDraw\bin\Release\net8.0-windows\win-x64\publish\GhostDraw.exe" | |
| $msiPath = "Installer\bin\x64\Release\GhostDrawSetup-${{ env.VERSION }}.msi" | |
| if (Test-Path $exePath) { | |
| Write-Host "✓ Application EXE built successfully" -ForegroundColor Green | |
| } else { | |
| Write-Error "Application EXE not found" | |
| exit 1 | |
| } | |
| if (Test-Path $msiPath) { | |
| $size = (Get-Item $msiPath).Length / 1MB | |
| Write-Host "✓ Installer MSI built successfully (${{ env.VERSION }})" -ForegroundColor Green | |
| Write-Host " Size: $([math]::Round($size, 2)) MB" -ForegroundColor Gray | |
| } else { | |
| Write-Error "Installer MSI not found at $msiPath" | |
| exit 1 | |
| } | |
| - name: Create portable zip | |
| shell: pwsh | |
| run: | | |
| $publishDir = "Src\GhostDraw\bin\Release\net8.0-windows\win-x64\publish" | |
| $zipPath = "GhostDraw-${{ env.VERSION }}-portable.zip" | |
| Compress-Archive -Path "$publishDir\*" -DestinationPath $zipPath -Force | |
| $size = (Get-Item $zipPath).Length / 1MB | |
| Write-Host "✓ Portable ZIP created: $zipPath" -ForegroundColor Green | |
| Write-Host " Size: $([math]::Round($size, 2)) MB" -ForegroundColor Gray | |
| - name: Delete old artifacts | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: | | |
| GhostDrawSetup-* | |
| GhostDraw-*-portable | |
| failOnError: false | |
| - name: Upload installer artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: GhostDrawSetup-${{ env.VERSION }} | |
| path: Installer/bin/x64/Release/GhostDrawSetup-${{ env.VERSION }}.msi | |
| retention-days: 30 | |
| - name: Upload portable artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: GhostDraw-${{ env.VERSION }}-portable | |
| path: GhostDraw-${{ env.VERSION }}-portable.zip | |
| retention-days: 30 |