构建可执行文件 #17
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: 构建可执行文件 | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: 构建于 ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ macos-latest, windows-latest, macos-13 ] | |
| steps: | |
| - name: 签出存储库 | |
| uses: actions/checkout@v4 | |
| - name: 设置 Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: 安装依赖项 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: 构建 Win 可执行文件 | |
| if: runner.os == 'Windows' | |
| run: | | |
| echo "DATE=$(Get-Date -Format 'yyyyMMdd')" >> $env:GITHUB_ENV | |
| pyinstaller --icon=./static/images/TikTokDownloader.ico --add-data "static:static" --add-data "locale:locale" --add-data "templates:templates" --collect-all emoji main.py | |
| shell: pwsh | |
| - name: 构建 Mac 可执行文件 | |
| if: runner.os == 'macOS' | |
| run: | | |
| echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
| pyinstaller --icon=./static/images/TikTokDownloader.icns --add-data "static:static" --add-data "locale:locale" --add-data "templates:templates" --collect-all emoji main.py | |
| - name: 上传文件 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: TikTokDownloader_${{ runner.os }}_${{ runner.arch }}_${{ env.DATE }} | |
| path: dist/main/ |