WIndow Orientation #54
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: Build Application with PyInstaller on Windows | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
name: Check out the repository code | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Find customtkinter path | |
id: find_path | |
run: | | |
$path = python -c "import customtkinter; import os; print(os.path.dirname(customtkinter.__file__))" | |
echo "CUSTOMTKINTER_PATH=$path" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Build the executable with PyInstaller | |
run: | | |
pyinstaller --noconfirm --onedir --windowed --icon ".\cmdcompass\static\icon.ico" --name "cmdCompass" ` | |
--add-data ".\cmdcompass\data:data" ` | |
--add-data ".\cmdcompass\static:static" ` | |
--add-data "${{ env.CUSTOMTKINTER_PATH }}:customtkinter" ` | |
--collect-all "tkinterweb" ` | |
--distpath ".\dist" ` | |
".\cmdcompass\main.py" | |
- name: Wait for 15 seconds | |
run: | | |
Start-Sleep -Seconds 15 | |
- name: Reorganize Files | |
run: | | |
Move-Item .\dist\cmdCompass\_internal\data .\dist\cmdCompass\data | |
Move-Item .\dist\cmdCompass\_internal\static .\dist\cmdCompass\static | |
New-Item -ItemType Directory -Force -Path .\release | |
- name: Create zip Archive | |
run: | | |
Compress-Archive -Path .\dist\cmdCompass\* -DestinationPath .\release\cmdCompass.zip | |
- name: Create 7z Archive | |
run: | | |
7z a .\release\cmdCompass.7z .\dist\cmdCompass\* | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cmdCompass-artifacts | |
path: | | |
.\release\cmdCompass.zip | |
.\release\cmdCompass.7z |