Chatify v0.3.0 — Reactions and Reliability Improvements #3
Workflow file for this run
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: Windows Release Package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Existing git tag to attach assets to (e.g., v1.2.3)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: windows-release-${{ github.event.release.id || github.run_id }} | |
| cancel-in-progress: false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-and-attach-windows-artifacts: | |
| if: ${{ github.event_name == 'release' || github.event_name == 'workflow_dispatch' }} | |
| runs-on: windows-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install stable Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Validate workspace release targets | |
| shell: pwsh | |
| run: .\scripts\assert-release-targets.ps1 | |
| - name: Validate manual tag input | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| shell: pwsh | |
| run: | | |
| $tag = "${{ inputs.tag }}" | |
| if ([string]::IsNullOrWhiteSpace($tag)) { | |
| throw "Input 'tag' is required for manual runs." | |
| } | |
| git rev-parse --verify "refs/tags/$tag" | Out-Null | |
| - name: Install Inno Setup | |
| shell: pwsh | |
| run: choco install innosetup --no-progress -y | |
| - name: Build Windows package | |
| shell: pwsh | |
| run: .\build-windows-package.ps1 | |
| - name: Smoke test packaged binaries | |
| shell: pwsh | |
| run: | | |
| $packageDir = "dist/chatify-windows-x64" | |
| $serverExe = Join-Path $packageDir "chatify-server.exe" | |
| $clientExe = Join-Path $packageDir "chatify-client.exe" | |
| foreach ($exe in @($serverExe, $clientExe)) { | |
| if (-not (Test-Path -Path $exe)) { | |
| throw "Missing packaged executable: $exe" | |
| } | |
| } | |
| $serverHelp = (& $serverExe --help 2>&1 | Out-String) | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "chatify-server --help failed with exit code $LASTEXITCODE" | |
| } | |
| if ([string]::IsNullOrWhiteSpace($serverHelp)) { | |
| throw "chatify-server --help returned empty output" | |
| } | |
| $clientHelp = (& $clientExe --help 2>&1 | Out-String) | |
| if ($LASTEXITCODE -ne 0) { | |
| throw "chatify-client --help failed with exit code $LASTEXITCODE" | |
| } | |
| if ([string]::IsNullOrWhiteSpace($clientHelp)) { | |
| throw "chatify-client --help returned empty output" | |
| } | |
| - name: Validate release artifacts | |
| shell: pwsh | |
| run: | | |
| $zipPath = "dist/chatify-windows-x64.zip" | |
| $shaPath = "dist/chatify-windows-x64.zip.sha256" | |
| $setup = Get-ChildItem -Path dist -Filter "chatify-setup-*.exe" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | |
| if (-not (Test-Path -Path $zipPath)) { | |
| throw "Missing artifact: $zipPath" | |
| } | |
| if (-not (Test-Path -Path $shaPath)) { | |
| throw "Missing checksum: $shaPath" | |
| } | |
| # Validate checksum file matches the generated zip checksum. | |
| $expectedHash = (Get-Content -Path $shaPath | Select-Object -First 1).Split(' ')[0].Trim().ToLowerInvariant() | |
| if ([string]::IsNullOrWhiteSpace($expectedHash)) { | |
| throw "Checksum file is empty or invalid: $shaPath" | |
| } | |
| $actualHash = (Get-FileHash -Path $zipPath -Algorithm SHA256).Hash.Trim().ToLowerInvariant() | |
| if ($actualHash -ne $expectedHash) { | |
| throw "Checksum mismatch for $zipPath. Expected $expectedHash but got $actualHash" | |
| } | |
| if (-not $setup) { | |
| throw "Missing installer artifact matching dist/chatify-setup-*.exe" | |
| } | |
| $setupPath = $setup.FullName | |
| $setupShaPath = "$setupPath.sha256" | |
| if (-not (Test-Path -Path $setupShaPath)) { | |
| throw "Missing installer checksum: $setupShaPath" | |
| } | |
| $expectedSetupHash = (Get-Content -Path $setupShaPath | Select-Object -First 1).Split(' ')[0].Trim().ToLowerInvariant() | |
| if ([string]::IsNullOrWhiteSpace($expectedSetupHash)) { | |
| throw "Installer checksum file is empty or invalid: $setupShaPath" | |
| } | |
| $actualSetupHash = (Get-FileHash -Path $setupPath -Algorithm SHA256).Hash.Trim().ToLowerInvariant() | |
| if ($actualSetupHash -ne $expectedSetupHash) { | |
| throw "Checksum mismatch for $setupPath. Expected $expectedSetupHash but got $actualSetupHash" | |
| } | |
| - name: Upload package as release asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.release.tag_name || inputs.tag }} | |
| fail_on_unmatched_files: true | |
| files: | | |
| dist/chatify-windows-x64.zip | |
| dist/chatify-windows-x64.zip.sha256 | |
| dist/chatify-setup-*.exe | |
| dist/chatify-setup-*.exe.sha256 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |