From 6a8b09ef353f8ec3fc0062533b857041f03d5267 Mon Sep 17 00:00:00 2001 From: "954801926@qq.com" Date: Thu, 30 Jul 2026 00:23:51 +0800 Subject: [PATCH] ci: add multi-platform release workflow on tag push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - version-check job: tag == package.json / Cargo.toml / tauri.conf.json - 3 平台矩阵: ubuntu (deb/AppImage/rpm), macos (app/dmg), windows (msi) - tauri-action 自动建 Release + 上传 assets - prerelease 自动识别 (含 -rc / -beta / -alpha 的 tag) - macOS unsigned: release body 注明用户首次启动需右键 → Open --- .github/workflows/release.yml | 87 +++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..35bfdb2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,87 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + version-check: + name: Version consistency + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - name: Verify tag matches package.json / Cargo.toml / tauri.conf.json + run: | + TAG="${GITHUB_REF_NAME}" + chmod +x scripts/check-version.sh + ./scripts/check-version.sh "$TAG" + + build: + name: Build (${{ matrix.platform }}) + needs: version-check + strategy: + fail-fast: false + matrix: + include: + - platform: ubuntu-latest + args: --bundles deb,appimage,rpm + - platform: macos-latest + args: --bundles app,dmg + - platform: windows-latest + args: --bundles msi + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - uses: actions/setup-rust@v1 + with: + cache: true + + - name: Install Linux build dependencies + if: matrix.platform == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y \ + libwebkit2gtk-4.1-dev \ + libappindicator3-dev \ + librsvg2-dev \ + patchelf \ + build-essential \ + curl \ + wget \ + file \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev + + - name: Build and upload release + uses: tauri-apps/tauri-action@v0 + with: + tagName: ${{ github.ref_name }} + releaseName: ${{ github.ref_name }} + releaseBody: | + ## ${{ github.ref_name }} + + ### Downloads by platform + + - **Windows**: `.msi` installer + - **macOS**: `.dmg` (unsigned — first launch needs right-click → Open) + `.app` + - **Linux**: `.deb` / `.AppImage` / `.rpm` + + Full changelog: see commit history. + releaseDraft: true + prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }} + args: ${{ matrix.args }}