feat: 使用 GitHub API 实现更新检查 #15
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: Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**.md' | |
| - '.gitignore' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [windows-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get commit messages since last tag | |
| id: changelog | |
| run: | | |
| # Get the last tag | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -z "$LAST_TAG" ]; then | |
| COMMITS=$(git log --pretty=format:"- %s" -20) | |
| else | |
| COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"- %s") | |
| fi | |
| if [ -z "$COMMITS" ]; then | |
| COMMITS="- Initial release" | |
| fi | |
| echo "commits<<EOF" >> $GITHUB_OUTPUT | |
| echo "$COMMITS" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Rust cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: './src-tauri -> target' | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt pyinstaller | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Build backend | |
| run: python build_backend.py | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: v${{ github.run_number }} | |
| releaseName: 'LoArchive v${{ github.run_number }}' | |
| releaseBody: | | |
| ## 🚀 LoArchive v${{ github.run_number }} | |
| ### 📝 更新内容 | |
| ${{ steps.changelog.outputs.commits }} | |
| --- | |
| ### 📥 下载说明 | |
| | 文件 | 说明 | | |
| |------|------| | |
| | `.msi` | Windows 安装包(推荐) | | |
| | `.exe` | Windows 便携版 | | |
| ### 🔧 使用方法 | |
| 1. 下载并安装 | |
| 2. 打开应用 | |
| 3. 在「设置」中配置 Lofter 登录信息 | |
| 4. 开始使用! | |
| --- | |
| <sub>构建时间: ${{ github.event.head_commit.timestamp }}</sub> | |
| releaseDraft: false | |
| prerelease: false |