Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a51f341cf3
|
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Upload Release (Windows EXE)
|
name: Build and Upload Release (Windows EXE from Ubuntu)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@@ -7,54 +7,55 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-windows-exe:
|
build-windows-exe:
|
||||||
name: Build Windows EXE
|
name: Build Windows EXE (PyInstaller via Docker on Ubuntu)
|
||||||
runs-on: windows-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Ensure tools (ImageMagick for .ico)
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
sudo apt-get update
|
||||||
if (Test-Path requirements.txt) { pip install -r requirements.txt }
|
sudo apt-get install -y imagemagick
|
||||||
pip install pyinstaller
|
|
||||||
|
|
||||||
- name: Build EXE with PyInstaller
|
- name: Prepare icon (optional)
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = 'Stop'
|
if [ -f "SeaLoader.png" ]; then
|
||||||
# Include SeaLoader.png so the packaged app icon in-app works
|
convert SeaLoader.png -resize 256x256 SeaLoader.ico || true
|
||||||
$addData = "SeaLoader.png;." # Windows uses ';' for --add-data
|
fi
|
||||||
pyinstaller --noconfirm --onefile --windowed sealoader_gui.py --name SeaLoader --add-data "$addData"
|
|
||||||
|
- name: Build EXE with PyInstaller (Windows target via Docker)
|
||||||
|
run: |
|
||||||
|
docker run --rm -v "$PWD":/src cdrx/pyinstaller-windows:python3 \
|
||||||
|
"/bin/sh -lc 'set -e; if [ -f requirements.txt ]; then pip install -r requirements.txt; fi; pyinstaller --noconfirm --onefile --windowed sealoader_gui.py --name SeaLoader --add-data ""SeaLoader.png;."" $( [ -f SeaLoader.ico ] && echo --icon SeaLoader.ico )'"
|
||||||
|
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
shell: pwsh
|
|
||||||
run: |
|
run: |
|
||||||
New-Item -ItemType Directory -Force -Path dist_upload | Out-Null
|
mkdir -p dist_upload
|
||||||
Copy-Item dist\SeaLoader.exe dist_upload\SeaLoader.exe
|
if [ -f dist/windows/SeaLoader.exe ]; then
|
||||||
if (Test-Path README.md) { Copy-Item README.md dist_upload\ }
|
cp dist/windows/SeaLoader.exe dist_upload/SeaLoader.exe
|
||||||
if (Test-Path LICENSE) { Copy-Item LICENSE dist_upload\ }
|
elif [ -f dist/SeaLoader.exe ]; then
|
||||||
Compress-Archive -Path dist_upload\* -DestinationPath SeaLoader_Windows_x64.zip -Force
|
cp dist/SeaLoader.exe dist_upload/SeaLoader.exe
|
||||||
|
else
|
||||||
|
echo "SeaLoader.exe not found" && ls -R dist || true && exit 1
|
||||||
|
fi
|
||||||
|
[ -f README.md ] && cp README.md dist_upload/ || true
|
||||||
|
[ -f LICENSE ] && cp LICENSE dist_upload/ || true
|
||||||
|
zip -r9 SeaLoader_Windows_x64.zip dist_upload
|
||||||
|
|
||||||
- name: Upload asset to Release
|
- name: Upload asset to Release
|
||||||
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
|
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
|
||||||
shell: pwsh
|
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
RELEASE_ID: ${{ github.event.release.id }}
|
RELEASE_ID: ${{ github.event.release.id }}
|
||||||
SERVER_URL: ${{ github.server_url }}
|
SERVER_URL: ${{ github.server_url }}
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = 'Stop'
|
set -e
|
||||||
$uploadUrl = "$env:SERVER_URL/api/v1/repos/$env:REPO/releases/$env:RELEASE_ID/assets?name=SeaLoader_Windows_x64.zip"
|
UPLOAD_URL="$SERVER_URL/api/v1/repos/$REPO/releases/$RELEASE_ID/assets?name=SeaLoader_Windows_x64.zip"
|
||||||
Write-Host "Uploading asset to $uploadUrl"
|
echo "Uploading asset to $UPLOAD_URL"
|
||||||
Invoke-RestMethod -Method Post -Uri $uploadUrl -Headers @{ Authorization = "token $env:TOKEN" } -ContentType "application/zip" -InFile "SeaLoader_Windows_x64.zip"
|
curl -fSL -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/zip" \
|
||||||
|
--data-binary @SeaLoader_Windows_x64.zip "$UPLOAD_URL"
|
||||||
|
|
||||||
- name: Upload artifact (CI logs)
|
- name: Upload artifact (CI logs)
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -62,5 +63,5 @@ jobs:
|
|||||||
name: SeaLoader_Windows_x64
|
name: SeaLoader_Windows_x64
|
||||||
path: |
|
path: |
|
||||||
SeaLoader_Windows_x64.zip
|
SeaLoader_Windows_x64.zip
|
||||||
dist/SeaLoader/SeaLoader.exe
|
dist/windows/SeaLoader.exe
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user