DevBox/.github/workflows/release.yaml

65 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: 'publish'
on:
push:
branches:
- release # 当代码推送到 release 分支时触发
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # 为 Apple Silicon (M1/M2) 构建
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # 为 Intel 芯片的 Mac 构建
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04' # 为 Linux 构建 (x86_64)
args: ''
- platform: 'windows-latest' # 为 Windows 构建 (x86_64)
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
# 1. 设置 Node.js 环境
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm' # 如果你用 yarn改成 'yarn';用 pnpm 改成 'pnpm'
# 2. 设置 Rust 环境
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
# 3. (仅 Linux) 安装系统依赖
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
# 4. 安装前端依赖并构建
- name: install frontend dependencies
run: pnpm install # 如果使用 yarn改为 yarn install
# 如果你的项目需要在构建前端后运行,可以添加以下步骤(可选)
# - name: build frontend
# run: npm run build
# 5. 核心步骤:使用 tauri-action 构建并发布
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__ # Release 的标签名
releaseName: 'App v__VERSION__' # Release 的标题
releaseBody: '请查看附件下载此版本。' # Release 的描述
releaseDraft: true # 是否创建为草稿,建议设为 true 以便最后检查
prerelease: false # 是否为预发布版本
args: ${{ matrix.args }}