Build and Release Barcode Reader Server (Multi-Platform) / build-linux (push) Successful in 1m3s
Build and Release Barcode Reader Server (Multi-Platform) / build-windows (push) Successful in 2m49s
Build and Release Barcode Reader Server (Multi-Platform) / build-macos (push) Successful in 56s
140 lines
5.9 KiB
YAML
140 lines
5.9 KiB
YAML
name: Build and Release Barcode Reader Server (Multi-Platform)
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
# -----------------------------------------------------------------
|
|
# JOB 1: WINDOWS INSTALLER (.exe)
|
|
# -----------------------------------------------------------------
|
|
build-windows:
|
|
runs-on: windows-native
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Rileva Python e compila binario PySide6
|
|
run: |
|
|
$TagVersion = "${{ github.ref_name }}".TrimStart('v')
|
|
$PyCmd = $null
|
|
if (Get-Command py -ErrorAction SilentlyContinue) {
|
|
$PyCmd = @("py", "-3")
|
|
} elseif (Get-Command python -ErrorAction SilentlyContinue) {
|
|
$PyCmd = @("python")
|
|
} elseif (Get-Command python3 -ErrorAction SilentlyContinue) {
|
|
$PyCmd = @("python3")
|
|
} else {
|
|
throw "Python 3 non trovato sul runner Windows."
|
|
}
|
|
|
|
if ($PyCmd.Count -gt 1) {
|
|
& $PyCmd[0] $PyCmd[1] server/build_binary.py --onedir --windowed --version "$TagVersion"
|
|
} else {
|
|
& $PyCmd[0] server/build_binary.py --onedir --windowed --version "$TagVersion"
|
|
}
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
|
|
- name: Firma opzionale eseguibile Windows
|
|
run: |
|
|
$PfxPath = "C:\flux_privato.pfx"
|
|
$PfxPass = "${{ secrets.PFX_PASSWORD }}"
|
|
if ((Test-Path $PfxPath) -and (-not [string]::IsNullOrWhiteSpace($PfxPass))) {
|
|
$Signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1).FullName
|
|
if ($Signtool) {
|
|
& $Signtool sign /f $PfxPath /p $PfxPass /fd SHA256 "server\dist\BarcodeServer\BarcodeServer.exe"
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
} else {
|
|
Write-Host "[i] signtool.exe non trovato: firma saltata."
|
|
}
|
|
} else {
|
|
Write-Host "[i] Certificato o PFX_PASSWORD non configurati: salto firma eseguibile."
|
|
}
|
|
|
|
- name: Build Installer Inno Setup
|
|
run: |
|
|
$TagVersion = "${{ github.ref_name }}".TrimStart('v')
|
|
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "/DMyAppVersion=$TagVersion" "server\win_installer.iss"
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
|
|
- name: Firma opzionale Installer Windows
|
|
run: |
|
|
$PfxPath = "C:\flux_privato.pfx"
|
|
$PfxPass = "${{ secrets.PFX_PASSWORD }}"
|
|
if ((Test-Path $PfxPath) -and (-not [string]::IsNullOrWhiteSpace($PfxPass))) {
|
|
$Signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" -ErrorAction SilentlyContinue | Sort-Object FullName -Descending | Select-Object -First 1).FullName
|
|
if ($Signtool) {
|
|
& $Signtool sign /f $PfxPath /p $PfxPass /fd SHA256 "server\dist\installer\BarcodeServerSetup.exe"
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
}
|
|
}
|
|
|
|
- name: Upload Windows Installer Asset
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: "server/dist/installer/BarcodeServerSetup.exe"
|
|
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
|
|
|
# -----------------------------------------------------------------
|
|
# JOB 2: LINUX APPIMAGE (.AppImage)
|
|
# -----------------------------------------------------------------
|
|
build-linux:
|
|
runs-on: linux-runner
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Compila binario e AppDir PySide6
|
|
run: |
|
|
TagVersion="${GITHUB_REF_NAME#v}"
|
|
python3 server/build_binary.py --onedir --windowed --appdir --version "$TagVersion"
|
|
|
|
- name: Scarica appimagetool se non presente
|
|
run: |
|
|
if [ ! -x /tmp/appimagetool-x86_64.AppImage ] || ! head -c 4 /tmp/appimagetool-x86_64.AppImage | grep -q "ELF"; then
|
|
rm -f /tmp/appimagetool-x86_64.AppImage
|
|
curl -fSL -o /tmp/appimagetool-x86_64.AppImage https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
|
|
chmod +x /tmp/appimagetool-x86_64.AppImage
|
|
fi
|
|
|
|
- name: Genera AppImage
|
|
run: |
|
|
ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 /tmp/appimagetool-x86_64.AppImage server/dist/BarcodeServer.AppDir BarcodeServer-x86_64.AppImage
|
|
chmod +x BarcodeServer-x86_64.AppImage
|
|
APPIMAGE_EXTRACT_AND_RUN=1 ./BarcodeServer-x86_64.AppImage --version
|
|
|
|
- name: Upload Linux AppImage Asset
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: "BarcodeServer-x86_64.AppImage"
|
|
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
|
|
|
# -----------------------------------------------------------------
|
|
# JOB 3: MACOS (.dmg e .zip per auto-update)
|
|
# -----------------------------------------------------------------
|
|
build-macos:
|
|
runs-on: macos-runner
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Compila bundle .app PySide6
|
|
run: |
|
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
|
TagVersion="${GITHUB_REF_NAME#v}"
|
|
python3 server/build_binary.py --onedir --windowed --version "$TagVersion"
|
|
|
|
- name: Genera DMG e ZIP macOS
|
|
run: |
|
|
hdiutil create -volname "Barcode Reader Server" -srcfolder "server/dist/BarcodeServer.app" -ov -format UDZO "BarcodeServer-macOS.dmg"
|
|
ditto -c -k --sequesterRsrc --keepParent "server/dist/BarcodeServer.app" "BarcodeServer-macOS.zip"
|
|
|
|
- name: Upload macOS Assets
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: |
|
|
BarcodeServer-macOS.dmg
|
|
BarcodeServer-macOS.zip
|
|
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
|
|