|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' # Triggers on version tags like v1.0.0, v1.2.3, etc. |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write # Required for creating releases |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-release: |
| 13 | + runs-on: windows-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout code |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 # Full history for proper versioning |
| 20 | + |
| 21 | + - name: Extract version from tag |
| 22 | + id: get_version |
| 23 | + shell: pwsh |
| 24 | + run: | |
| 25 | + $tag = "${{ github.ref_name }}" |
| 26 | + $version = $tag -replace '^v', '' |
| 27 | + echo "VERSION=$version" >> $env:GITHUB_OUTPUT |
| 28 | + echo "Version: $version" |
| 29 | +
|
| 30 | + - name: Setup .NET 8 |
| 31 | + uses: actions/setup-dotnet@v4 |
| 32 | + with: |
| 33 | + dotnet-version: '8.0.x' |
| 34 | + |
| 35 | + - name: Install WiX Toolset |
| 36 | + shell: pwsh |
| 37 | + run: | |
| 38 | + dotnet tool install --global wix --version 4.0.5 |
| 39 | + dotnet --version |
| 40 | + wix --version |
| 41 | +
|
| 42 | + - name: Restore dependencies |
| 43 | + run: dotnet restore src/GhostDraw.csproj |
| 44 | + |
| 45 | + - name: Build and publish application |
| 46 | + shell: pwsh |
| 47 | + run: | |
| 48 | + dotnet publish src/GhostDraw.csproj ` |
| 49 | + -c Release ` |
| 50 | + -r win-x64 ` |
| 51 | + --self-contained true ` |
| 52 | + -p:PublishSingleFile=false ` |
| 53 | + -p:Version=${{ steps.get_version.outputs.VERSION }} |
| 54 | +
|
| 55 | + - name: Generate WiX component list |
| 56 | + shell: pwsh |
| 57 | + working-directory: installer |
| 58 | + run: | |
| 59 | + .\Generate-FileList.ps1 ` |
| 60 | + -PublishPath "..\src\bin\Release\net8.0-windows\win-x64\publish" ` |
| 61 | + -OutputFile "HarvestedFiles.wxs" |
| 62 | +
|
| 63 | + - name: Build installer MSI |
| 64 | + shell: pwsh |
| 65 | + working-directory: installer |
| 66 | + run: | |
| 67 | + dotnet build GhostDraw.Installer.wixproj ` |
| 68 | + -c Release ` |
| 69 | + -p:Version=${{ steps.get_version.outputs.VERSION }} ` |
| 70 | + -p:PublishDir="..\src\bin\Release\net8.0-windows\win-x64\publish\" |
| 71 | +
|
| 72 | + - name: Verify installer created |
| 73 | + shell: pwsh |
| 74 | + run: | |
| 75 | + $msiPath = "installer\bin\x64\Release\GhostDrawSetup-${{ steps.get_version.outputs.VERSION }}.msi" |
| 76 | + if (Test-Path $msiPath) { |
| 77 | + $size = (Get-Item $msiPath).Length / 1MB |
| 78 | + Write-Host "✓ Installer created: $msiPath" |
| 79 | + Write-Host " Size: $([math]::Round($size, 2)) MB" |
| 80 | + } else { |
| 81 | + Write-Error "Installer not found at: $msiPath" |
| 82 | + exit 1 |
| 83 | + } |
| 84 | +
|
| 85 | + - name: Create GitHub Release |
| 86 | + id: create_release |
| 87 | + uses: actions/create-release@v1 |
| 88 | + env: |
| 89 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + with: |
| 91 | + tag_name: ${{ github.ref_name }} |
| 92 | + release_name: GhostDraw ${{ steps.get_version.outputs.VERSION }} |
| 93 | + body: | |
| 94 | + ## GhostDraw v${{ steps.get_version.outputs.VERSION }} |
| 95 | +
|
| 96 | + ### Installation |
| 97 | +
|
| 98 | + Download `GhostDrawSetup-${{ steps.get_version.outputs.VERSION }}.msi` and run it. |
| 99 | +
|
| 100 | + **Requirements:** Windows 10/11 (64-bit) - No additional dependencies needed |
| 101 | +
|
| 102 | + ### Features |
| 103 | +
|
| 104 | + - Press and hold **Ctrl+Alt+D**, then click and drag to draw on screen |
| 105 | + - Release **Ctrl+Alt+D** to clear the drawing |
| 106 | + - Press **ESC** to force clear if needed |
| 107 | + - Runs in system tray |
| 108 | + - Configurable hotkeys, colors, and brush thickness |
| 109 | +
|
| 110 | + ### What's Changed |
| 111 | +
|
| 112 | + See commit history for detailed changes. |
| 113 | +
|
| 114 | + --- |
| 115 | +
|
| 116 | + 🤖 Generated with [GitHub Actions](https://github.com/${{ github.repository }}/actions) |
| 117 | + draft: false |
| 118 | + prerelease: false |
| 119 | + |
| 120 | + - name: Upload MSI to Release |
| 121 | + uses: actions/upload-release-asset@v1 |
| 122 | + env: |
| 123 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + with: |
| 125 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 126 | + asset_path: ./installer/bin/x64/Release/GhostDrawSetup-${{ steps.get_version.outputs.VERSION }}.msi |
| 127 | + asset_name: GhostDrawSetup-${{ steps.get_version.outputs.VERSION }}.msi |
| 128 | + asset_content_type: application/x-msi |
| 129 | + |
| 130 | + - name: Build summary |
| 131 | + shell: pwsh |
| 132 | + run: | |
| 133 | + Write-Host "=====================================" -ForegroundColor Cyan |
| 134 | + Write-Host " Release Build Complete! " -ForegroundColor Green |
| 135 | + Write-Host "=====================================" -ForegroundColor Cyan |
| 136 | + Write-Host "" |
| 137 | + Write-Host "Version: ${{ steps.get_version.outputs.VERSION }}" -ForegroundColor White |
| 138 | + Write-Host "Installer: GhostDrawSetup-${{ steps.get_version.outputs.VERSION }}.msi" -ForegroundColor White |
| 139 | + Write-Host "Release: ${{ steps.create_release.outputs.html_url }}" -ForegroundColor White |
0 commit comments