[feat] 添加管理员模式 #82
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
| # 贡献者注意: | |
| # 下面的 hook-win10toast.py 迁移不要删 | |
| name: Build and Push Python Binaries | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| cache: 'pip' | |
| - name: Compile Python scripts for Linux | |
| run: | | |
| pip install -r requirements_linux.txt | |
| mkdir -p bin/linux | |
| pyinstaller --onefile --distpath bin/linux chat.py | |
| pyinstaller --onefile --noconsole --distpath bin/linux client.py | |
| rm chat.spec client.spec | |
| rm -rf build/ | |
| - name: Upload Linux binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-binaries | |
| path: bin/linux/ | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| cache: 'pip' | |
| - name: Compile Python scripts for Windows | |
| run: | | |
| pip install -r requirements.txt | |
| Copy-Item -Path hook-win10toast.py C:\\hostedtoolcache\\windows\\Python\\3.10.11\\x64\\lib\\site-packages\\PyInstaller\\hooks\\ | |
| mkdir -Force bin/windows | |
| pyinstaller --onefile --distpath bin/windows chat.py | |
| pyinstaller --onefile --noconsole --distpath bin/windows client.py | |
| Remove-Item -Path "chat.spec", "client.spec" -Force | |
| Remove-Item -Path ".\build" -Recurse -Force | |
| - name: Upload Windows binaries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-binaries | |
| path: bin/windows/ | |
| push-binaries: | |
| needs: [build-windows, build-linux] | |
| runs-on: ubuntu-latest | |
| if: success() | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Download Windows binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-binaries | |
| path: bin/windows/ | |
| - name: Download Linux binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-binaries | |
| path: bin/linux/ | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@users.noreply.github.com" | |
| - name: Add and commit binaries | |
| run: | | |
| git add bin/windows/ | |
| git add bin/linux/ | |
| git commit -m "[skip ci] [Bot] Add compiled binaries" || echo "No changes to commit" | |
| - name: Push changes | |
| run: git push |