ci: 更新github release构建工作流
1. 统一使用双引号包裹字符串 2. 调整权限配置位置,简化依赖安装步骤 3. 更新pnpm和rust缓存action版本 4. 完善发布包的名称为StealthReader
This commit is contained in:
parent
e6780d6f6c
commit
d070ea8aa7
|
|
@ -1,89 +1,74 @@
|
|||
name: 'Publish Release'
|
||||
name: "Publish Release"
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # 推送 v1.0.0 之类的 tag 时触发
|
||||
workflow_dispatch: # 也支持手动触发
|
||||
- "v*" # 推送 v1.0.0 之类的 tag 时触发
|
||||
workflow_dispatch: # 也支持手动触发
|
||||
|
||||
permissions:
|
||||
contents: write # 需要写入权限来创建 Release
|
||||
|
||||
jobs:
|
||||
publish-tauri:
|
||||
permissions:
|
||||
contents: write # 需要写入权限来创建 Release
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# macOS Apple Silicon (M1/M2/M3)
|
||||
- platform: 'macos-latest'
|
||||
args: '--target aarch64-apple-darwin'
|
||||
- platform: "macos-latest"
|
||||
args: "--target aarch64-apple-darwin"
|
||||
|
||||
# macOS Intel
|
||||
- platform: 'macos-latest'
|
||||
args: '--target x86_64-apple-darwin'
|
||||
|
||||
# Linux x64
|
||||
- platform: 'ubuntu-22.04'
|
||||
args: ''
|
||||
|
||||
# Linux ARM64(仅公开仓库可用)
|
||||
- platform: 'ubuntu-22.04-arm'
|
||||
args: ''
|
||||
- platform: "macos-latest"
|
||||
args: "--target x86_64-apple-darwin"
|
||||
|
||||
# Windows x64
|
||||
- platform: 'windows-latest'
|
||||
args: ''
|
||||
- platform: "windows-latest"
|
||||
args: ""
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
steps:
|
||||
# 1. 检出代码
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
# 2. 安装 Linux 系统依赖(仅 Ubuntu)
|
||||
- name: Install dependencies (Ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-22.04-arm'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# 3. 安装 Node.js
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v6
|
||||
with:
|
||||
version: 10
|
||||
version: 11
|
||||
|
||||
- name: Setup Node.js
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: lts/*
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: pnpm-lock.yaml
|
||||
cache: "pnpm"
|
||||
|
||||
# 4. 安装 Rust
|
||||
- name: Install Rust stable
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
# 5. Rust 缓存(大幅加速后续构建)
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
- name: Cache Rust build
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src-tauri -> target'
|
||||
workspaces: src-tauri
|
||||
|
||||
# 6. 安装前端依赖
|
||||
- name: Install frontend dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
# 7. 构建并发布(核心步骤)
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
- name: Build app & publish release
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tagName: v__VERSION__ # 自动替换为 tauri.conf.json 里的版本号
|
||||
releaseName: 'App v__VERSION__'
|
||||
releaseBody: 'See the assets to download and install.'
|
||||
releaseDraft: true # 先创建草稿,手动确认后再发布
|
||||
tagName: v__VERSION__ # 自动替换为 tauri.conf.json 里的版本号
|
||||
releaseName: "StealthReader v__VERSION__"
|
||||
releaseBody: "See the assets to download and install."
|
||||
releaseDraft: true # 先创建草稿,手动确认后再发布
|
||||
prerelease: false
|
||||
args: ${{ matrix.args }}
|
||||
|
|
|
|||
Loading…
Reference in New Issue