All checks were successful
Build and Upload Release (Windows EXE) / Build Windows EXE (release) Successful in 2m32s
71 lines
2.6 KiB
YAML
71 lines
2.6 KiB
YAML
name: Build and Upload Release (Windows EXE)
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
build-windows-exe:
|
|
name: Build Windows EXE
|
|
runs-on: windows
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Install dependencies
|
|
shell: powershell
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
if (Test-Path requirements.txt) { pip install -r requirements.txt }
|
|
pip install pyinstaller
|
|
|
|
- name: Build EXE with PyInstaller
|
|
shell: powershell
|
|
run: |
|
|
$ErrorActionPreference = 'Stop'
|
|
# Stamp version into sealoader_version.py from release tag
|
|
if ($env:GITHUB_EVENT_NAME -eq 'release') {
|
|
$tag = '${{ github.event.release.tag_name }}'
|
|
} else {
|
|
$tag = (git describe --tags --always) 2>$null
|
|
if (-not $tag) { $tag = "0.0.0-dev" }
|
|
}
|
|
("__version__ = '" + $tag + "'") | Out-File -FilePath sealoader_version.py -Encoding UTF8 -Force
|
|
# Bundle PNG resources referenced at runtime
|
|
pyinstaller --noconfirm --onefile --windowed sealoader_gui.py --name SeaLoader `
|
|
--add-data "SeaLoader.png;." `
|
|
--add-data "hrsys.png;." `
|
|
--icon SeaLoader.ico
|
|
|
|
- name: Prepare artifact
|
|
shell: powershell
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path dist_upload | Out-Null
|
|
Copy-Item dist\SeaLoader.exe dist_upload\SeaLoader.exe
|
|
if (Test-Path README.md) { Copy-Item README.md dist_upload\ }
|
|
if (Test-Path LICENSE) { Copy-Item LICENSE dist_upload\ }
|
|
Compress-Archive -Path dist_upload\* -DestinationPath SeaLoader_Windows_x64.zip -Force
|
|
|
|
- name: Upload asset to Release
|
|
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
|
|
shell: powershell
|
|
env:
|
|
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
REPO: ${{ github.repository }}
|
|
RELEASE_ID: ${{ github.event.release.id }}
|
|
SERVER_URL: ${{ github.server_url }}
|
|
run: |
|
|
$ErrorActionPreference = 'Stop'
|
|
$uploadUrl = "$env:SERVER_URL/api/v1/repos/$env:REPO/releases/$env:RELEASE_ID/assets?name=SeaLoader_Windows_x64.zip"
|
|
Write-Host "Uploading asset to $uploadUrl"
|
|
Invoke-RestMethod -Method Post -Uri $uploadUrl -Headers @{ Authorization = "token $env:TOKEN" } -ContentType "application/zip" -InFile "SeaLoader_Windows_x64.zip"
|
|
|
|
# CI artifact upload removed for GHES compatibility
|
|
|