Create build-portable.yml #1
This file contains hidden or 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 Portable EXE | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| jobs: | |
| build-windows-portable: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: Build portable exe | |
| run: | | |
| pyinstaller --onefile --windowed --name "ExcelComparePortable" main.py | |
| - name: Prepare portable package | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path portable -Force | Out-Null | |
| Copy-Item "dist/ExcelComparePortable.exe" "portable/ExcelComparePortable.exe" -Force | |
| if (Test-Path "test_data") { | |
| Copy-Item "test_data" "portable/test_data" -Recurse -Force | |
| } | |
| Compress-Archive -Path "portable/*" -DestinationPath "dist/ExcelComparePortable.zip" -Force | |
| - name: Upload EXE artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ExcelComparePortable-exe | |
| path: dist/ExcelComparePortable.exe | |
| - name: Upload ZIP artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ExcelComparePortable-zip | |
| path: dist/ExcelComparePortable.zip |