Development Build and Release Electron App #25
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: Development Build and Release Electron App | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: 'Branch to checkout and build' | |
| required: false | |
| default: 'dev' | |
| permissions: | |
| contents: write | |
| jobs: | |
| buildExe: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| name: linux | |
| - os: windows-latest | |
| name: nsis | |
| - os: windows-latest | |
| name: appx | |
| - os: macos-14 | |
| name: mac | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.branch || github.ref }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Set up Python (macOS için distutils) | |
| if: matrix.os == 'macos-14' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Python build deps (macOS) | |
| if: matrix.os == 'macos-14' | |
| run: | | |
| python3 -m ensurepip --upgrade | |
| python3 -m pip install --upgrade pip setuptools | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build Native Addon (audio-loopback) | |
| shell: bash | |
| run: | | |
| cd native/audio-loopback | |
| npm install | |
| npm run build | |
| - name: Build Electron App | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.name }}" = "linux" ]; then | |
| npm run build:linux | |
| elif [ "${{ matrix.name }}" = "nsis" ]; then | |
| npm run build:winexe | |
| elif [ "${{ matrix.name }}" = "appx" ]; then | |
| npm run build:winstore | |
| elif [ "${{ matrix.name }}" = "mac" ]; then | |
| npm run build:mac | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ✅ Package.json'dan version bilgisini al | |
| - name: Get version from package.json | |
| if: matrix.os == 'windows-latest' | |
| id: package-version | |
| run: | | |
| $version = (Get-Content package.json | ConvertFrom-Json).version | |
| echo "version=$version" >> $env:GITHUB_OUTPUT | |
| echo "Version: $version" | |
| shell: powershell | |
| # ✅ Dosyaların varlığını kontrol et | |
| - name: List dist files (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| echo "Checking dist directory contents:" | |
| if (Test-Path "dist") { | |
| Get-ChildItem -Path "dist" -Recurse | ForEach-Object { Write-Host $_.FullName } | |
| } else { | |
| Write-Host "dist directory does not exist!" | |
| exit 1 | |
| } | |
| shell: powershell | |
| # ✅ Windows için eSigner ile imzala - NSIS Installer | |
| - name: Sign NSIS Installer | |
| if: matrix.os == 'windows-latest' && matrix.name == 'nsis' | |
| uses: sslcom/esigner-codesign@develop | |
| with: | |
| command: sign | |
| username: ${{ secrets.ESIGNER_USERNAME }} | |
| password: ${{ secrets.ESIGNER_PASSWORD }} | |
| credential_id: ${{ secrets.ESIGNER_CREDENTIAL_ID }} | |
| totp_secret: ${{ secrets.ESIGNER_TOTP }} | |
| file_path: dist/Topluyo-Setup-${{ steps.package-version.outputs.version }}.exe | |
| malware_block: false | |
| override: true | |
| clean_logs: false | |
| - name: Update latest.yml after signing (NSIS) | |
| if: matrix.os == 'windows-latest' && matrix.name == 'nsis' | |
| run: | | |
| $exeFile = "dist/Topluyo-Setup-${{ steps.package-version.outputs.version }}.exe" | |
| $version = "${{ steps.package-version.outputs.version }}" | |
| # İmzalanmış dosyanın yeni SHA512 değerini hesapla | |
| $fileHash = Get-FileHash -Path $exeFile -Algorithm SHA512 | |
| # Hex string'i byte array'e çevir ve sonra Base64'e çevir | |
| $hexBytes = [byte[]] -split ($fileHash.Hash -replace '..', '0x$& ') | |
| $sha512 = [System.Convert]::ToBase64String($hexBytes) | |
| # Dosya boyutunu al | |
| $fileSize = (Get-Item $exeFile).Length | |
| # Yeni latest.yml içeriğini oluştur | |
| $currentDate = (Get-Date).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") | |
| $latestYml = "version: $version`n" + | |
| "files:`n" + | |
| " - url: Topluyo-Setup-$version.exe`n" + | |
| " sha512: $sha512`n" + | |
| " size: $fileSize`n" + | |
| "path: Topluyo-Setup-$version.exe`n" + | |
| "sha512: $sha512`n" + | |
| "releaseDate: '$currentDate'" | |
| # latest.yml dosyasını güncelle (BOM olmadan UTF8) | |
| [System.IO.File]::WriteAllText("dist/latest.yml", $latestYml, [System.Text.UTF8Encoding]::new($false)) | |
| Write-Host "latest.yml updated with new SHA512: $sha512" | |
| Write-Host "File size: $fileSize bytes" | |
| shell: powershell | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Topluyo-${{ matrix.name }}-${{ github.run_number }} | |
| path: dist/* | |
| retention-days: 5 |