name: Build Windows EXE on: push: branches: ["main"] workflow_dispatch: jobs: build: runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: "3.9" - name: Install deps run: | pip install pyinstaller keyboard pywin32 - name: Build EXE run: | pyinstaller --onefile --windowed --name Shortcut_Sync_PotPlayer main.py - name: Upload uses: actions/upload-artifact@v4 with: name: exe path: dist/Shortcut_Sync_PotPlayer.exe - name: Build with PyInstaller run: | # --clean 确保清理旧缓存 # --admin-access 如果你的程序需要监听全局钩子,有时需要此权限 python -m PyInstaller --noconfirm --onefile --windowed --name "Shortcut_Sync_PotPlayer" main.py - name: Upload Artifact uses: actions/upload-artifact@v4 with: name: PotPlayer-Sync-Tool path: dist/Shortcut_Sync_PotPlayer.exe retention-days: 7 # 临时文件保存7天