name: Release on: push: tags: - 'v*' workflow_dispatch: inputs: version: description: 'Version to build (e.g. 1.0.0)' required: true permissions: contents: write jobs: build: runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: '8.0.x' - name: Resolve version id: ver shell: pwsh run: | if ('${{ github.event_name }}' -eq 'workflow_dispatch') { $v = '${{ github.event.inputs.version }}' } else { $v = '${{ github.ref_name }}' -replace '^v','' } "version=$v" >> $env:GITHUB_OUTPUT Write-Host "Building version $v" - name: Test run: dotnet test WhatSprintIsItWallpaper.sln -c Release --nologo - name: Publish (self-contained, single file) shell: pwsh run: > dotnet publish src/WhatSprintIsItWallpaper/WhatSprintIsItWallpaper.csproj -c Release -r win-x64 -p:Version=${{ steps.ver.outputs.version }} -p:SelfContained=true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -o publish/win-x64 - name: Build MSI (WiX) shell: pwsh run: > dotnet build installer/WhatSprintIsItWallpaper.wixproj -c Release -p:ProductVersion=${{ steps.ver.outputs.version }} -p:PublishDir=${{ github.workspace }}/publish/win-x64 - name: Compute SHA256 and ProductCode id: hash shell: pwsh run: | $file = "installer/bin/Release/WhatSprintIsItWallpaper-${{ steps.ver.outputs.version }}.msi" $sha = (Get-FileHash $file -Algorithm SHA256).Hash "sha256=$sha" >> $env:GITHUB_OUTPUT # Read the auto-generated ProductCode from the MSI (needed for the winget manifest). $wi = New-Object -ComObject WindowsInstaller.Installer $db = $wi.GetType().InvokeMember('OpenDatabase','InvokeMethod',$null,$wi,@((Resolve-Path $file).Path,0)) $view = $db.GetType().InvokeMember('OpenView','InvokeMethod',$null,$db,@("SELECT Value FROM Property WHERE Property='ProductCode'")) $view.GetType().InvokeMember('Execute','InvokeMethod',$null,$view,$null) | Out-Null $rec = $view.GetType().InvokeMember('Fetch','InvokeMethod',$null,$view,$null) $productCode = $rec.GetType().InvokeMember('StringData','GetProperty',$null,$rec,@(1)) "productcode=$productCode" >> $env:GITHUB_OUTPUT Write-Host "MSI SHA256: $sha" Write-Host "MSI ProductCode: $productCode" "### MSI details`n- **SHA256:** ``$sha```n- **ProductCode:** ``$productCode```n- **UpgradeCode:** ``{7B2D9E14-4C3A-4F5B-9A21-8C0D2E7F1A93}``" >> $env:GITHUB_STEP_SUMMARY - name: Upload build artifact uses: actions/upload-artifact@v4 with: name: WhatSprintIsItWallpaper-msi path: installer/bin/Release/*.msi - name: Create GitHub Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: installer/bin/Release/WhatSprintIsItWallpaper-${{ steps.ver.outputs.version }}.msi body: | ## WhatSprintIsItWallpaper ${{ steps.ver.outputs.version }} Per-user installer (no admin required). After installing, the desktop wallpaper updates automatically at logon and once daily — no further action needed. **MSI SHA256:** `${{ steps.hash.outputs.sha256 }}` **ProductCode:** `${{ steps.hash.outputs.productcode }}` Update the winget manifest under `winget/` with this URL and SHA256, then submit a PR to [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs).