Desktop Build and Release #12
Workflow file for this run
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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| platform: mac | |
| - os: windows-latest | |
| platform: win | |
| - os: ubuntu-latest | |
| platform: linux | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| # 显式使用与 package.json 中一致的 pnpm 版本 | |
| version: 9.15.0 | |
| run_install: false | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build for ${{ matrix.platform }} | |
| run: pnpm electron:build:${{ matrix.platform }} | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Remove universal exe (keep only arch-specific) | |
| if: matrix.platform == 'win' | |
| shell: bash | |
| run: | | |
| # 删除通用 exe,只保留带架构标识的 | |
| find dist -name "*.exe" ! -name "*-x64.exe" ! -name "*-arm64.exe" -delete || true | |
| - name: Remove debug files | |
| shell: bash | |
| run: | | |
| # 删除 builder-debug.yml | |
| find dist -name "builder-debug.yml" -delete || true | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform }}-build | |
| path: | | |
| dist/*.dmg | |
| dist/*-x64.exe | |
| dist/*-arm64.exe | |
| dist/*.AppImage | |
| dist/*.deb | |
| dist/latest*.yml | |
| if-no-files-found: ignore | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: artifacts/**/* | |
| draft: false | |
| prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }} | |
| generate_release_notes: true | |
| body: | | |
| ## 📦 下载安装 | |
| | 平台 | 芯片 | 下载文件示例 | | |
| |------|------|--------------| | |
| | macOS | Intel 芯片 | `PromptHub-x.x.x-x64.dmg` | | |
| | macOS | M 系列芯片 | `PromptHub-x.x.x-arm64.dmg` | | |
| | Windows | x64 | `PromptHub-Setup-x.x.x-x64.exe` | | |
| | Linux | x64 | `PromptHub-x.x.x.AppImage` / `.deb` | | |
| > 💡 实际文件名中的 `x.x.x` 会是本次发布的版本号,例如 `0.1.6`。 | |
| ### ⚠️ macOS 首次启动 | |
| 如果提示"无法打开"或"已损坏",请在终端执行: | |
| ```bash | |
| sudo xattr -rd com.apple.quarantine /Applications/PromptHub.app | |
| ``` | |
| --- | |
| ## 🔄 本次更新 | |
| 详细更新日志请查看 [更新日志](https://github.com/legeling/PromptHub#-更新日志) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |