Windows Workflow #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows Workflow | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python environment | |
shell: cmd | |
run: | | |
echo Setting up the virtual environment... | |
python3.exe -m venv venv | |
if errorlevel 1 ( | |
echo Failed to create virtual environment. | |
exit /b 1 | |
) | |
- name: Install dependencies | |
shell: cmd | |
run: | | |
echo Installing dependencies... | |
venv\Scripts\python.exe -m pip install --upgrade pip >nul 2>&1 | |
venv\Scripts\python.exe -m pip install -v -r requirements-windows.txt | |
if errorlevel 1 ( | |
echo Failed to install dependencies. | |
exit /b 1 | |
) | |
- name: Install PyInstaller | |
shell: cmd | |
run: | | |
echo Installing PyInstaller... | |
venv\Scripts\python.exe -m pip install pyinstaller | |
if errorlevel 1 ( | |
echo Failed to install PyInstaller. | |
exit /b 1 | |
) | |
- name: Download and extract fonts and icons | |
shell: pwsh | |
run: | | |
echo Downloading fonts... | |
New-Item -ItemType Directory -Path fonts -Force | |
New-Item -ItemType Directory -Path icons -Force | |
# Download fonts | |
$fontUrls = @( | |
"https://github.com/rdey/rdey-packages/raw/refs/heads/master/design/fonts/Inter-Regular.ttf", | |
"https://github.com/rdey/rdey-packages/raw/refs/heads/master/design/fonts/Inter-Bold.ttf", | |
"https://github.com/rdey/rdey-packages/raw/refs/heads/master/design/fonts/Inter-Italic.ttf", | |
"https://github.com/rdey/rdey-packages/raw/refs/heads/master/design/fonts/Inter-BoldItalic.ttf" | |
) | |
foreach ($url in $fontUrls) { | |
$filename = "fonts\" + [System.IO.Path]::GetFileName($url) | |
Invoke-WebRequest -Uri $url -OutFile $filename | |
echo "Downloaded $filename" | |
} | |
echo Downloading icons... | |
$iconUrl = "http://archive.ubuntu.com/ubuntu/pool/universe/x/xubuntu-artwork/xubuntu-artwork_16.04.2.tar.xz" | |
$iconTarFile = "icons\xubuntu-artwork_16.04.2.tar.xz" | |
Invoke-WebRequest -Uri $iconUrl -OutFile $iconTarFile | |
echo Extracting icons... | |
# Use 7-Zip to extract the tar.xz file | |
& "C:\Program Files\7-Zip\7z.exe" x $iconTarFile -oicons | |
Remove-Item $iconTarFile | |
- name: Create executable | |
shell: cmd | |
run: | | |
echo Creating executable... | |
venv\Scripts\python.exe -m PyInstaller --noconsole --onefile --add-data "fonts;fonts" --add-data "icons;icons" siracusa.py | |
if errorlevel 1 ( | |
echo Failed to create executable. | |
exit /b 1 | |
) | |
- name: Upload venv as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: venv | |
path: venv | |
retention-days: 1 | |
- name: Upload executable as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: siracusa-executable | |
path: dist/siracusa.exe | |
retention-days: 1 |