ci(release): cross-compile and publish both Linux and Windows release binaries from Linux node
This commit is contained in:
+14
-130
@@ -1,9 +1,11 @@
|
||||
name: Release Binaries & Installers
|
||||
name: Release Binaries & Packages
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
@@ -12,8 +14,8 @@ on:
|
||||
default: 'v3.0.0'
|
||||
|
||||
jobs:
|
||||
release-linux:
|
||||
name: Build & Release Linux Binaries
|
||||
release:
|
||||
name: Build & Release Standalone Binaries (Linux & Windows Cross-Compilation)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
@@ -21,27 +23,27 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install System and Python Build Dependencies
|
||||
- name: Install System and Cross-Compilation Build Dependencies
|
||||
run: |
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
echo "[*] Installing Python shared libraries and headers for PyInstaller..."
|
||||
echo "[*] Installing Python shared libraries, headers, and build dependencies..."
|
||||
SUDO=""
|
||||
if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1; then
|
||||
SUDO="sudo"
|
||||
fi
|
||||
$SUDO apt-get update && $SUDO apt-get install -y --no-install-recommends python3-dev libpython3-dev python3-all-dev "libpython3.*" || true
|
||||
$SUDO apt-get update && $SUDO apt-get install -y --no-install-recommends \
|
||||
python3-dev libpython3-dev python3-all-dev "libpython3.*" \
|
||||
innosetup wine wine64 || true
|
||||
fi
|
||||
python3 compilation/ensure_pip.py
|
||||
python3 -m pip install --upgrade pip --break-system-packages 2>/dev/null || python3 -m pip install --upgrade pip 2>/dev/null || true
|
||||
python3 -m pip install pyinstaller -r compilation/requirements.txt --break-system-packages 2>/dev/null || python3 -m pip install pyinstaller -r compilation/requirements.txt
|
||||
python3 -m pip install pyinstaller distlib cryptography -r compilation/requirements.txt --break-system-packages 2>/dev/null || python3 -m pip install pyinstaller distlib cryptography -r compilation/requirements.txt
|
||||
|
||||
|
||||
|
||||
- name: Compile Standalone Linux Binaries
|
||||
- name: Compile Standalone Binaries (Linux & Windows)
|
||||
run: |
|
||||
python3 compilation/package_dist.py --target linux
|
||||
python3 compilation/package_dist.py --target all
|
||||
|
||||
- name: Publish Linux Release Assets
|
||||
- name: Publish Unified Release Assets
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.TAG_TOKEN || github.token }}
|
||||
GITEA_SERVER_URL: ${{ github.server_url }}
|
||||
@@ -49,121 +51,3 @@ jobs:
|
||||
GITEA_REF_NAME: ${{ inputs.tag || github.event.release.tag_name || github.ref_name }}
|
||||
run: |
|
||||
python3 compilation/upload_release.py --skip-build
|
||||
|
||||
release-windows:
|
||||
name: Build & Release Windows Binaries & Installers
|
||||
# Note: Requires a registered Gitea Act Runner with label 'windows-latest'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
shell: powershell
|
||||
run: |
|
||||
$server = "${{ github.server_url }}"
|
||||
$token = "${{ secrets.TAG_TOKEN || github.token }}"
|
||||
$repo = "${{ github.repository }}"
|
||||
$sha = "${{ github.sha }}"
|
||||
$cleanUrl = $server -replace "^https?://", ""
|
||||
$authUrl = "https://${token}@${cleanUrl}/${repo}.git"
|
||||
|
||||
# Discover and append Git install paths to PATH if missing
|
||||
$gitCandidatePaths = @(
|
||||
"C:\Program Files\Git\cmd",
|
||||
"C:\Program Files\Git\bin",
|
||||
"C:\Program Files (x86)\Git\cmd",
|
||||
"C:\Program Files (x86)\Git\bin",
|
||||
"C:\ProgramData\chocolatey\bin",
|
||||
"$env:LOCALAPPDATA\Programs\Git\cmd"
|
||||
)
|
||||
foreach ($p in $gitCandidatePaths) {
|
||||
if ((Test-Path $p) -and ($env:PATH -notlike "*$p*")) {
|
||||
$env:PATH = "$p;$env:PATH"
|
||||
}
|
||||
}
|
||||
|
||||
$gitCmd = Get-Command "git" -ErrorAction SilentlyContinue
|
||||
if ($gitCmd) {
|
||||
Write-Host "[+] Found Git at $($gitCmd.Source)"
|
||||
if (-not (Test-Path ".git")) {
|
||||
& git init
|
||||
& git remote add origin $authUrl
|
||||
} else {
|
||||
& git remote set-url origin $authUrl
|
||||
}
|
||||
& git fetch --depth 1 origin $sha
|
||||
& git checkout -f FETCH_HEAD
|
||||
} else {
|
||||
Write-Host "[!] Git binary not found in PATH. Downloading repository archive via Gitea API..."
|
||||
$zipUrl = "$server/api/v1/repos/$repo/archive/$sha.zip"
|
||||
$headers = @{ "Authorization" = "token $token" }
|
||||
$zipPath = "$env:TEMP\repo_$sha.zip"
|
||||
$extractPath = "$env:TEMP\repo_extract_$sha"
|
||||
Invoke-RestMethod -Uri $zipUrl -Headers $headers -OutFile $zipPath -ErrorAction Stop
|
||||
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
|
||||
$inner = Get-ChildItem -Path $extractPath | Where-Object { $_.PSIsContainer } | Select-Object -First 1
|
||||
if ($inner) {
|
||||
Copy-Item -Path "$($inner.FullName)\*" -Destination "." -Recurse -Force
|
||||
} else {
|
||||
Copy-Item -Path "$extractPath\*" -Destination "." -Recurse -Force
|
||||
}
|
||||
Remove-Item -Path $zipPath, $extractPath -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "[+] Repository successfully extracted from ZIP archive."
|
||||
}
|
||||
|
||||
- name: Install Dependencies
|
||||
shell: powershell
|
||||
run: |
|
||||
$py = "python"
|
||||
if (-not (Get-Command "python" -ErrorAction SilentlyContinue)) {
|
||||
if (Get-Command "py" -ErrorAction SilentlyContinue) {
|
||||
$py = "py -3.12"
|
||||
}
|
||||
}
|
||||
& $py -m pip install --upgrade pip
|
||||
& $py -m pip install pyinstaller cryptography -r compilation/requirements.txt
|
||||
|
||||
- name: Compile Standalone Windows Binaries
|
||||
shell: powershell
|
||||
run: |
|
||||
$py = "python"
|
||||
if (-not (Get-Command "python" -ErrorAction SilentlyContinue)) {
|
||||
if (Get-Command "py" -ErrorAction SilentlyContinue) {
|
||||
$py = "py -3.12"
|
||||
}
|
||||
}
|
||||
& $py compilation/package_dist.py --target windows
|
||||
|
||||
- name: Compile Inno Setup Installers
|
||||
shell: powershell
|
||||
run: |
|
||||
$iscc = $null
|
||||
if (Test-Path "C:\Program Files (x86)\Inno Setup 6\ISCC.exe") {
|
||||
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
|
||||
} elseif (Test-Path "C:\Program Files\Inno Setup 6\ISCC.exe") {
|
||||
$iscc = "C:\Program Files\Inno Setup 6\ISCC.exe"
|
||||
} elseif (Get-Command "ISCC.exe" -ErrorAction SilentlyContinue) {
|
||||
$iscc = "ISCC.exe"
|
||||
}
|
||||
|
||||
if ($iscc) {
|
||||
Write-Host "[*] Compiling Windows Inno Setup installers using $iscc..."
|
||||
& $iscc compilation/installer_client.iss
|
||||
& $iscc compilation/installer_server.iss
|
||||
} else {
|
||||
Write-Host "[!] Inno Setup compiler (ISCC.exe) not found on runner host. Skipping installer compilation."
|
||||
}
|
||||
|
||||
- name: Publish Windows Release Assets
|
||||
shell: powershell
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.TAG_TOKEN || github.token }}
|
||||
GITEA_SERVER_URL: ${{ github.server_url }}
|
||||
GITEA_REPOSITORY: ${{ github.repository }}
|
||||
GITEA_REF_NAME: ${{ inputs.tag || github.event.release.tag_name || github.ref_name }}
|
||||
run: |
|
||||
$py = "python"
|
||||
if (-not (Get-Command "python" -ErrorAction SilentlyContinue)) {
|
||||
if (Get-Command "py" -ErrorAction SilentlyContinue) {
|
||||
$py = "py -3.12"
|
||||
}
|
||||
}
|
||||
& $py compilation/upload_release.py --skip-build
|
||||
|
||||
Reference in New Issue
Block a user