Skip to content

chore(release): bump desktop/package.json to v3.7.0 #210

chore(release): bump desktop/package.json to v3.7.0

chore(release): bump desktop/package.json to v3.7.0 #210

Workflow file for this run

name: Desktop Build
on:
push:
branches: [master]
tags: ["v*"]
paths:
- "desktop/**"
- "src/**"
- "frontend/**"
pull_request:
branches: [master]
paths:
- "desktop/**"
- "src/**"
- "frontend/**"
workflow_dispatch:
permissions:
contents: read
jobs:
test-desktop:
name: Test Desktop (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install desktop dependencies
working-directory: desktop
shell: bash
run: |
if [ -f package-lock.json ]; then
npm ci
else
echo "No package-lock.json found — running npm install"
npm install
fi
- name: Run desktop tests
working-directory: desktop
run: npm test
build-desktop:
name: Build (${{ matrix.platform }})
needs: test-desktop
runs-on: ${{ matrix.os }}
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
build_cmd: npm run build:linux
- os: windows-latest
platform: windows
build_cmd: npm run build:win
- os: macos-latest
platform: mac-x64
build_cmd: npm run build:mac -- --x64
- os: macos-latest
platform: mac-arm64
build_cmd: npm run build:mac -- --arm64
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python dependencies
run: |
pip install -e ".[dev]"
pip install pyinstaller
- name: Install OCR tooling (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y tesseract-ocr poppler-utils
- name: Install OCR tooling (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install tesseract poppler
- name: Install OCR tooling (Windows)
# Mirrors release-desktop.yml: chocolatey-with-retry + direct
# UB-Mannheim fallback for Tesseract, direct download for Poppler.
# See release-desktop.yml for the rationale (chronic 504s from
# community.chocolatey.org).
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$ErrorActionPreference = 'Continue'
$tessPath = "C:\Program Files\Tesseract-OCR\tesseract.exe"
$chocoOk = $false
for ($attempt = 1; $attempt -le 3 -and -not $chocoOk; $attempt++) {
Write-Host "chocolatey tesseract install attempt $attempt/3"
choco install tesseract --no-progress -y --no-color
if ($LASTEXITCODE -eq 0 -and (Test-Path $tessPath)) {
$chocoOk = $true
Write-Host " choco succeeded on attempt $attempt"
} else {
Write-Host " choco failed (exit $LASTEXITCODE); sleeping $($attempt * 20)s"
if ($attempt -lt 3) { Start-Sleep -Seconds ($attempt * 20) }
}
}
if (-not $chocoOk) {
Write-Host "chocolatey unavailable; falling back to direct UB-Mannheim installer"
$tessUrl = "https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-w64-setup-5.4.0.20240606.exe"
$tessExe = "$env:TEMP\tesseract-setup.exe"
Invoke-WebRequest -Uri $tessUrl -OutFile $tessExe -UseBasicParsing
Start-Process -FilePath $tessExe -ArgumentList "/S" -Wait -NoNewWindow
}
if (-not (Test-Path $tessPath)) {
throw "Tesseract install failed after chocolatey + direct fallback: tesseract.exe not found"
}
$popplerUrl = "https://github.com/oschwartz10612/poppler-windows/releases/download/v24.08.0-0/Release-24.08.0-0.zip"
$popplerZip = "$env:TEMP\poppler.zip"
Invoke-WebRequest -Uri $popplerUrl -OutFile $popplerZip -UseBasicParsing
Expand-Archive -Path $popplerZip -DestinationPath "$env:TEMP\poppler_extract" -Force
$inner = Get-ChildItem -Path "$env:TEMP\poppler_extract" -Directory | Select-Object -First 1
if ($null -eq $inner) { throw "Poppler archive had unexpected layout" }
New-Item -ItemType Directory -Path "C:\Program Files\poppler" -Force | Out-Null
Copy-Item -Path "$($inner.FullName)\*" -Destination "C:\Program Files\poppler\" -Recurse -Force
if (-not (Test-Path "C:\Program Files\poppler\Library\bin\pdftoppm.exe")) {
throw "Poppler install failed: pdftoppm.exe not found"
}
- name: Build backend
working-directory: desktop
shell: bash
run: |
if [ -f package-lock.json ]; then npm ci; else npm install; fi
npm run build:backend
- name: Install frontend dependencies
working-directory: frontend
run: npm install
- name: Build frontend (static export for Electron)
working-directory: frontend
shell: bash
env:
ELECTRON_BUILD: "1"
# Must match BACKEND_HOST:BACKEND_PORT in desktop/src/backend.js.
NEXT_PUBLIC_API_URL: "http://127.0.0.1:18741"
run: npx next build
- name: Fix _next/ asset paths for Electron subpages
working-directory: frontend
shell: bash
run: python3 ../scripts/fix_electron_paths.py
- name: Copy frontend output
shell: bash
run: |
mkdir -p desktop/build/frontend
if [ -d "frontend/out" ]; then
cp -r frontend/out/. desktop/build/frontend/
else
echo "Error: frontend/out not found. Ensure ELECTRON_BUILD=1 was set." >&2
exit 1
fi
- name: Generate app icon (purple octopus DJ)
shell: bash
run: |
pip install pillow --quiet
python3 scripts/generate_icon.py
- name: Build installer
working-directory: desktop
run: ${{ matrix.build_cmd }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: odia-desktop-${{ matrix.platform }}
path: |
desktop/dist/*.dmg
desktop/dist/*.exe
desktop/dist/*.AppImage
retention-days: 30