ci
This commit is contained in:
1 parent
08aeaa3f42
commit
58b9a8543f
4 files changed
+205
-21
No files matched your search
+104
-20
@@ -69,14 +69,49 @@ jobs:
|
||||
}
|
||||
}
|
||||
|
||||
- name: Upload Windows Installer Asset
|
||||
- name: Upload Windows Installer Asset su Gitea Release
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: "server/dist/installer/BarcodeServerSetup.exe"
|
||||
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
||||
|
||||
- name: Pubblica Windows Installer su apps.catelli.it
|
||||
env:
|
||||
VPS_HOST: ${{ secrets.VPS_HOST }}
|
||||
VPS_USER: ${{ secrets.VPS_USER }}
|
||||
VPS_PORT: ${{ secrets.VPS_PORT }}
|
||||
VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
|
||||
VPS_APPS_DOWNLOADS_DIR: ${{ secrets.VPS_APPS_DOWNLOADS_DIR }}
|
||||
run: |
|
||||
if ([string]::IsNullOrWhiteSpace($env:VPS_SSH_KEY)) {
|
||||
Write-Host "[!] Secret VPS_SSH_KEY non configurato: salto deploy su apps.catelli.it."
|
||||
exit 0
|
||||
}
|
||||
$VpsHost = if ([string]::IsNullOrWhiteSpace($env:VPS_HOST)) { "vps.catelli.it" } else { $env:VPS_HOST }
|
||||
$VpsUser = if ([string]::IsNullOrWhiteSpace($env:VPS_USER)) { "mark" } else { $env:VPS_USER }
|
||||
$Port = if ([string]::IsNullOrWhiteSpace($env:VPS_PORT)) { "22" } else { $env:VPS_PORT }
|
||||
$DestDir = if ([string]::IsNullOrWhiteSpace($env:VPS_APPS_DOWNLOADS_DIR)) { "/home/mark/caddy-docker/apps.catelli.it/downloads" } else { $env:VPS_APPS_DOWNLOADS_DIR.TrimEnd('/') }
|
||||
$KeyFile = Join-Path $env:TEMP ("vps_deploy_key_" + [guid]::NewGuid().ToString("N"))
|
||||
try {
|
||||
$NormalizedKey = $env:VPS_SSH_KEY.Replace("`r`n", "`n").TrimEnd() + "`n"
|
||||
[System.IO.File]::WriteAllText($KeyFile, $NormalizedKey, (New-Object System.Text.UTF8Encoding($false)))
|
||||
& icacls $KeyFile /inheritance:r /grant:r "$($env:USERNAME):(R)" | Out-Null
|
||||
|
||||
$SshOpts = @("-i", $KeyFile, "-o", "StrictHostKeyChecking=accept-new", "-o", "BatchMode=yes")
|
||||
& ssh.exe @SshOpts -p $Port "$VpsUser@$VpsHost" "mkdir -p '$DestDir' && chmod 755 '$DestDir'"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
& scp.exe @SshOpts -P $Port "server\dist\installer\BarcodeServerSetup.exe" "$VpsUser@$VpsHost`:$DestDir/BarcodeServerSetup.exe.tmp"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
& ssh.exe @SshOpts -p $Port "$VpsUser@$VpsHost" "chmod 644 '$DestDir/BarcodeServerSetup.exe.tmp' && mv -f '$DestDir/BarcodeServerSetup.exe.tmp' '$DestDir/BarcodeServerSetup.exe'"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
} finally {
|
||||
if (Test-Path $KeyFile) { Remove-Item -Force $KeyFile }
|
||||
}
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# JOB 2: LINUX APPIMAGE (.AppImage)
|
||||
# JOB 2: LINUX APPIMAGE (.AppImage via Docker Ubuntu 22.04)
|
||||
# -----------------------------------------------------------------
|
||||
build-linux:
|
||||
runs-on: linux-runner
|
||||
@@ -84,31 +119,53 @@ jobs:
|
||||
- name: Checkout del codice
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Compila binario e AppDir PySide6
|
||||
- name: Prepara immagine Docker (Ubuntu 22.04 / glibc compatibile)
|
||||
run: |
|
||||
docker build -t barcode-linux-builder -f docker/linux-appimage.Dockerfile .
|
||||
|
||||
- name: Build Server Linux e Genera AppImage nel container
|
||||
run: |
|
||||
TagVersion="${GITHUB_REF_NAME#v}"
|
||||
python3 server/build_binary.py --onedir --windowed --appdir --version "$TagVersion"
|
||||
docker run --rm \
|
||||
-e HOST_UID="$(id -u)" \
|
||||
-e HOST_GID="$(id -g)" \
|
||||
-e APP_VERSION="$TagVersion" \
|
||||
-v "$PWD:/workspace" \
|
||||
barcode-linux-builder
|
||||
|
||||
- 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
|
||||
- name: Upload Linux AppImage Asset su Gitea Release
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: "BarcodeServer-x86_64.AppImage"
|
||||
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
||||
|
||||
- name: Pubblica Linux AppImage su apps.catelli.it
|
||||
env:
|
||||
VPS_HOST: ${{ secrets.VPS_HOST }}
|
||||
VPS_USER: ${{ secrets.VPS_USER }}
|
||||
VPS_PORT: ${{ secrets.VPS_PORT }}
|
||||
VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
|
||||
VPS_APPS_DOWNLOADS_DIR: ${{ secrets.VPS_APPS_DOWNLOADS_DIR }}
|
||||
run: |
|
||||
if [ -z "${VPS_SSH_KEY:-}" ]; then
|
||||
echo "[!] Secret VPS_SSH_KEY non configurato: salto deploy su apps.catelli.it."
|
||||
exit 0
|
||||
fi
|
||||
HOST="${VPS_HOST:-vps.catelli.it}"
|
||||
USER="${VPS_USER:-mark}"
|
||||
PORT="${VPS_PORT:-22}"
|
||||
DEST_DIR="${VPS_APPS_DOWNLOADS_DIR:-/home/mark/caddy-docker/apps.catelli.it/downloads}"
|
||||
DEST_DIR="${DEST_DIR%/}"
|
||||
KEY_FILE="$(mktemp)"
|
||||
trap 'rm -f "$KEY_FILE"' EXIT
|
||||
printf '%s\n' "$VPS_SSH_KEY" > "$KEY_FILE"
|
||||
chmod 600 "$KEY_FILE"
|
||||
|
||||
SSH_OPTS=(-i "$KEY_FILE" -o StrictHostKeyChecking=accept-new -o BatchMode=yes)
|
||||
ssh "${SSH_OPTS[@]}" -p "$PORT" "${USER}@${HOST}" "mkdir -p '${DEST_DIR}' && chmod 755 '${DEST_DIR}'"
|
||||
scp "${SSH_OPTS[@]}" -P "$PORT" "BarcodeServer-x86_64.AppImage" "${USER}@${HOST}:${DEST_DIR}/BarcodeServer-x86_64.AppImage.tmp"
|
||||
ssh "${SSH_OPTS[@]}" -p "$PORT" "${USER}@${HOST}" "chmod 644 '${DEST_DIR}/BarcodeServer-x86_64.AppImage.tmp' && mv -f '${DEST_DIR}/BarcodeServer-x86_64.AppImage.tmp' '${DEST_DIR}/BarcodeServer-x86_64.AppImage'"
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# JOB 3: MACOS (.dmg e .zip per auto-update)
|
||||
# -----------------------------------------------------------------
|
||||
@@ -129,7 +186,7 @@ jobs:
|
||||
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
|
||||
- name: Upload macOS Assets su Gitea Release
|
||||
uses: https://gitea.com/actions/release-action@main
|
||||
with:
|
||||
files: |
|
||||
@@ -137,3 +194,30 @@ jobs:
|
||||
BarcodeServer-macOS.zip
|
||||
api_key: ${{ secrets.MYRELEASE_TOKEN }}
|
||||
|
||||
- name: Pubblica macOS DMG e ZIP su apps.catelli.it
|
||||
env:
|
||||
VPS_HOST: ${{ secrets.VPS_HOST }}
|
||||
VPS_USER: ${{ secrets.VPS_USER }}
|
||||
VPS_PORT: ${{ secrets.VPS_PORT }}
|
||||
VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
|
||||
VPS_APPS_DOWNLOADS_DIR: ${{ secrets.VPS_APPS_DOWNLOADS_DIR }}
|
||||
run: |
|
||||
if [ -z "${VPS_SSH_KEY:-}" ]; then
|
||||
echo "[!] Secret VPS_SSH_KEY non configurato: salto deploy su apps.catelli.it."
|
||||
exit 0
|
||||
fi
|
||||
HOST="${VPS_HOST:-vps.catelli.it}"
|
||||
USER="${VPS_USER:-mark}"
|
||||
PORT="${VPS_PORT:-22}"
|
||||
DEST_DIR="${VPS_APPS_DOWNLOADS_DIR:-/home/mark/caddy-docker/apps.catelli.it/downloads}"
|
||||
DEST_DIR="${DEST_DIR%/}"
|
||||
KEY_FILE="$(mktemp)"
|
||||
trap 'rm -f "$KEY_FILE"' EXIT
|
||||
printf '%s\n' "$VPS_SSH_KEY" > "$KEY_FILE"
|
||||
chmod 600 "$KEY_FILE"
|
||||
|
||||
SSH_OPTS=(-i "$KEY_FILE" -o StrictHostKeyChecking=accept-new -o BatchMode=yes)
|
||||
ssh "${SSH_OPTS[@]}" -p "$PORT" "${USER}@${HOST}" "mkdir -p '${DEST_DIR}' && chmod 755 '${DEST_DIR}'"
|
||||
scp "${SSH_OPTS[@]}" -P "$PORT" "BarcodeServer-macOS.dmg" "${USER}@${HOST}:${DEST_DIR}/BarcodeServer-macOS.dmg.tmp"
|
||||
scp "${SSH_OPTS[@]}" -P "$PORT" "BarcodeServer-macOS.zip" "${USER}@${HOST}:${DEST_DIR}/BarcodeServer-macOS.zip.tmp"
|
||||
ssh "${SSH_OPTS[@]}" -p "$PORT" "${USER}@${HOST}" "chmod 644 '${DEST_DIR}/BarcodeServer-macOS.dmg.tmp' '${DEST_DIR}/BarcodeServer-macOS.zip.tmp' && mv -f '${DEST_DIR}/BarcodeServer-macOS.dmg.tmp' '${DEST_DIR}/BarcodeServer-macOS.dmg' && mv -f '${DEST_DIR}/BarcodeServer-macOS.zip.tmp' '${DEST_DIR}/BarcodeServer-macOS.zip'"
|
||||
Reference in new issue
Block a user