Update build.yml : 修复无法自动编译 #38
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 123pan | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Verify required files exist | |
| id: check_files | |
| run: | | |
| if (Test-Path "android.py" -PathType Leaf) { | |
| echo "::set-output name=should_build::true" | |
| } else { | |
| echo "::set-output name=should_build::false" | |
| } | |
| - name: Set up Python | |
| if: steps.check_files.outputs.should_build == 'true' | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.8' | |
| - name: Install dependencies | |
| if: steps.check_files.outputs.should_build == 'true' | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt | |
| - name: Build with PyInstaller | |
| if: steps.check_files.outputs.should_build == 'true' | |
| run: | | |
| python -m Pyinstaller --onefile --windowed --icon=icon.ico --clean --exclude-module=PyQt5.QtWebEngine 123pan.py | |
| - name: Upload artifacts | |
| if: steps.check_files.outputs.should_build == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-app-${{ github.run_number }} | |
| path: dist/ | |
| retention-days: 1 |