224 lines
8.6 KiB
YAML
224 lines
8.6 KiB
YAML
name: Build and Release FLUX (Multi-Platform)
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
# -----------------------------------------------------------------
|
|
# JOB 1: WINDOWS (Gira sul PC del collega appena si libera)
|
|
# -----------------------------------------------------------------
|
|
build-windows:
|
|
runs-on: windows-native
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Crea file .env
|
|
run: |
|
|
Set-Content -Path ".env" -Value "${{ secrets.ENV_FILE_CONTENT }}"
|
|
|
|
- name: Pulizia Cache Dart e Download Dipendenze
|
|
run: |
|
|
if (Test-Path ".dart_tool") { Remove-Item -Recurse -Force ".dart_tool" }
|
|
flutter pub get
|
|
|
|
- name: Build Flutter Windows
|
|
run: flutter build windows --release
|
|
|
|
# 1. FIRMA DELL'ESEGUIBILE RAW
|
|
- name: Firma Eseguibile Flutter
|
|
run: |
|
|
# Cerca dinamicamente signtool.exe nell'SDK di Windows per non sbagliare percorso
|
|
$Signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object FullName -Descending | Select-Object -First 1).FullName
|
|
|
|
# Sostituisci il percorso con dove hai salvato fisicamente il file .pfx sul PC del runner!
|
|
& $Signtool sign /f "C:\flux_privato.pfx" /p "${{ secrets.PFX_PASSWORD }}" /fd SHA256 "build\windows\x64\runner\Release\flux.exe"
|
|
|
|
- name: Build Windows Installer
|
|
run: |
|
|
$TagVersion = "${{ github.ref_name }}".Substring(1)
|
|
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "/DMyAppVersion=$TagVersion" "win_installer.iss"
|
|
|
|
# 2. FIRMA DELL'INSTALLER GENERATO DA INNO SETUP
|
|
- name: Firma Installer
|
|
run: |
|
|
$Signtool = (Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object FullName -Descending | Select-Object -First 1).FullName
|
|
|
|
& $Signtool sign /f "C:\flux_privato.pfx" /p "${{ secrets.PFX_PASSWORD }}" /fd SHA256 "build\windows\installer\FluxInstaller.exe"
|
|
|
|
# Nel dubbio usiamo l'action per caricare l'asset
|
|
- name: Upload Windows Asset
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: "build/windows/installer/FluxInstaller.exe"
|
|
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
|
|
|
- name: Aggiorna Link Windows su Supabase
|
|
run: |
|
|
$TagVersion = "${{ github.ref_name }}".TrimStart('v')
|
|
$apiKey = "${{ secrets.SUPABASE_SERVICE_KEY }}"
|
|
if ([string]::IsNullOrWhiteSpace($apiKey)) {
|
|
$apiKey = "sb_publishable_kyzeAS6kxuGB9WLkRilc79_pYWsKdVo"
|
|
}
|
|
$body = @{
|
|
download_url = "https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/FluxInstaller.exe"
|
|
latest_version = $TagVersion
|
|
} | ConvertTo-Json -Compress
|
|
|
|
[System.IO.File]::WriteAllText("$PWD\payload.json", $body, (New-Object System.Text.UTF8Encoding($false)))
|
|
curl.exe -i -X PATCH "https://supabaseapi.catelli.it/rest/v1/app_config?platform=eq.windows" `
|
|
-H "apikey: $apiKey" `
|
|
-H "Authorization: Bearer $apiKey" `
|
|
-H "Content-Type: application/json" `
|
|
--data-binary "@payload.json"
|
|
Remove-Item -Force "$PWD\payload.json"
|
|
|
|
- name: Pulisci Workspace Windows
|
|
if: always()
|
|
run: Remove-Item -Recurse -Force ./*
|
|
|
|
|
|
# -----------------------------------------------------------------
|
|
# JOB 3: WEB & CLOUDFLARE DEPLOY (Gira sul runner Fedora o Mac)
|
|
# -----------------------------------------------------------------
|
|
build-web:
|
|
runs-on: cross-runner
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Crea file .env
|
|
run: |
|
|
cat << 'EOF' > .env
|
|
${{ secrets.ENV_FILE_CONTENT }}
|
|
EOF
|
|
|
|
- name: Pulizia Cache e Fetch Dipendenze
|
|
run: |
|
|
rm -rf .dart_tool
|
|
flutter pub get
|
|
|
|
- name: Build Flutter Web
|
|
run: flutter build web --release
|
|
|
|
# Sfruttiamo npx (incluso in Node.js) per lanciare wrangler al volo senza installarlo globalmente
|
|
# Sto assumendo che usi Cloudflare Pages che è perfetto per Flutter Web statico
|
|
- name: Deploy su Cloudflare Pages
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
run: |
|
|
npx wrangler pages deploy build/web --project-name="flux" --branch="main"
|
|
|
|
- name: Aggiorna Versione Web su Supabase
|
|
run: |
|
|
TagVersion="${GITHUB_REF_NAME#v}"
|
|
API_KEY="${{ secrets.SUPABASE_SERVICE_KEY }}"
|
|
if [ -z "$API_KEY" ]; then
|
|
API_KEY="sb_publishable_kyzeAS6kxuGB9WLkRilc79_pYWsKdVo"
|
|
fi
|
|
curl -X PATCH "https://supabaseapi.catelli.it/rest/v1/app_config?platform=eq.web" \
|
|
-H "apikey: $API_KEY" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"latest_version\": \"$TagVersion\"}"
|
|
|
|
# -----------------------------------------------------------------
|
|
# JOB 4: LINUX APPIMAGE (Build isolata su Ubuntu 22.04 via Docker)
|
|
# -----------------------------------------------------------------
|
|
build-linux:
|
|
runs-on: linux-runner # <--- Etichetta del tuo runner Linux in ufficio
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Crea file .env
|
|
run: |
|
|
cat << 'EOF' > .env
|
|
${{ secrets.ENV_FILE_CONTENT }}
|
|
EOF
|
|
|
|
- name: Prepara immagine Docker (Ubuntu 22.04 / x86-64-baseline)
|
|
run: |
|
|
docker build -t flux-linux-builder -f docker/linux-appimage.Dockerfile docker
|
|
|
|
- name: Build Flutter Linux e Genera AppImage nel container
|
|
run: |
|
|
docker run --rm \
|
|
-e HOST_UID="$(id -u)" \
|
|
-e HOST_GID="$(id -g)" \
|
|
-v "$PWD:/workspace" \
|
|
flux-linux-builder
|
|
|
|
- name: Upload Linux AppImage Asset
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: "Flux-x86_64.AppImage"
|
|
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
|
|
|
- name: Aggiorna Link Linux su Supabase
|
|
run: |
|
|
TagVersion="${GITHUB_REF_NAME#v}"
|
|
API_KEY="${{ secrets.SUPABASE_SERVICE_KEY }}"
|
|
if [ -z "$API_KEY" ]; then
|
|
API_KEY="sb_publishable_kyzeAS6kxuGB9WLkRilc79_pYWsKdVo"
|
|
fi
|
|
curl -X PATCH "https://supabaseapi.catelli.it/rest/v1/app_config?platform=eq.AppImage" \
|
|
-H "apikey: $API_KEY" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/Flux-x86_64.AppImage\", \"latest_version\": \"$TagVersion\"}"
|
|
|
|
# -----------------------------------------------------------------
|
|
# JOB 5: MACOS (Gira sul tuo Mac / macos-runner)
|
|
# -----------------------------------------------------------------
|
|
build-macos:
|
|
runs-on: macos-runner
|
|
steps:
|
|
- name: Checkout del codice
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Crea file .env
|
|
run: |
|
|
cat << 'EOF' > .env
|
|
${{ secrets.ENV_FILE_CONTENT }}
|
|
EOF
|
|
|
|
- name: Pulizia Cache e Fetch Dipendenze
|
|
run: |
|
|
rm -rf .dart_tool
|
|
flutter pub get
|
|
|
|
- name: Build Flutter macOS
|
|
run: flutter build macos --release
|
|
|
|
- name: Genera DMG e ZIP macOS
|
|
run: |
|
|
# Crea DMG dell'applicazione
|
|
hdiutil create -volname "Flux" -srcfolder "build/macos/Build/Products/Release/flux.app" -ov -format UDZO "Flux-macOS.dmg"
|
|
|
|
# Crea anche archivio ZIP di backup
|
|
cd build/macos/Build/Products/Release
|
|
zip -r -y ../../../../Flux-macOS.zip "flux.app"
|
|
cd -
|
|
|
|
- name: Upload macOS Assets
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: |
|
|
Flux-macOS.dmg
|
|
Flux-macOS.zip
|
|
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
|
|
|
- name: Aggiorna Link macOS su Supabase
|
|
run: |
|
|
TagVersion="${GITHUB_REF_NAME#v}"
|
|
API_KEY="${{ secrets.SUPABASE_SERVICE_KEY }}"
|
|
if [ -z "$API_KEY" ]; then
|
|
API_KEY="sb_publishable_kyzeAS6kxuGB9WLkRilc79_pYWsKdVo"
|
|
fi
|
|
curl -X PATCH "https://supabaseapi.catelli.it/rest/v1/app_config?platform=eq.macos" \
|
|
-H "apikey: $API_KEY" \
|
|
-H "Authorization: Bearer $API_KEY" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/Flux-macOS.dmg\", \"latest_version\": \"$TagVersion\"}" |