fix: matplotlib DejaVu Sans 缺少 CJK glyph,配置 Microsoft YaHei + 抑制 warning #28
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 and Release EXE | |
| on: | |
| push: | |
| branches: [releases] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\AppData\Local\pip\Cache | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pyinstaller | |
| pip install -r requirements.txt | |
| - name: Build with PyInstaller | |
| shell: cmd | |
| run: | | |
| pyinstaller --onefile --windowed --name "BiliMonitor" ^ | |
| --collect-all customtkinter ^ | |
| --collect-all bilibili_api ^ | |
| --hidden-import plyer.platforms.win.notification ^ | |
| --hidden-import PIL._tkinter_finder ^ | |
| --hidden-import pandas ^ | |
| --hidden-import sklearn ^ | |
| --hidden-import scipy ^ | |
| --hidden-import statsmodels ^ | |
| --hidden-import xgboost ^ | |
| --hidden-import lightgbm ^ | |
| --hidden-import prophet ^ | |
| main.py | |
| - name: Generate release tag | |
| id: tag | |
| shell: pwsh | |
| run: | | |
| $date = Get-Date -Format "yyyyMMdd-HHmmss" | |
| echo "release_tag=release-$date" >> $env:GITHUB_OUTPUT | |
| - name: Extract latest changelog | |
| shell: python | |
| run: | | |
| import re | |
| with open("CHANGELOG.md", "r", encoding="utf-8") as f: | |
| content = f.read() | |
| # 提取第一个 ## Release 条目 | |
| match = re.search( | |
| r'(## Release \d{4}-\d{2}-\d{2}[\s\S]*?)(?=\n## Release |\Z)', | |
| content, | |
| ) | |
| if match: | |
| body = match.group(1).strip() | |
| else: | |
| body = "无 CHANGELOG 条目" | |
| with open("release_body.md", "w", encoding="utf-8") as f: | |
| f.write(body) | |
| - name: Publish to GitHub Releases | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.release_tag }} | |
| name: BiliMonitor ${{ steps.tag.outputs.release_tag }} | |
| body_path: release_body.md | |
| files: dist/BiliMonitor.exe | |
| fail_on_unmatched_files: false |