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:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*' # 推送 v1.0.0 之类的 tag 时触发
|
- "v*" # 推送 v1.0.0 之类的 tag 时触发
|
||||||
workflow_dispatch: # 也支持手动触发
|
workflow_dispatch: # 也支持手动触发
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write # 需要写入权限来创建 Release
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-tauri:
|
publish-tauri:
|
||||||
permissions:
|
|
||||||
contents: write # 需要写入权限来创建 Release
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# macOS Apple Silicon (M1/M2/M3)
|
# macOS Apple Silicon (M1/M2/M3)
|
||||||
- platform: 'macos-latest'
|
- platform: "macos-latest"
|
||||||
args: '--target aarch64-apple-darwin'
|
args: "--target aarch64-apple-darwin"
|
||||||
|
|
||||||
# macOS Intel
|
# macOS Intel
|
||||||
- platform: 'macos-latest'
|
- platform: "macos-latest"
|
||||||
args: '--target x86_64-apple-darwin'
|
args: "--target x86_64-apple-darwin"
|
||||||
|
|
||||||
# Linux x64
|
|
||||||
- platform: 'ubuntu-22.04'
|
|
||||||
args: ''
|
|
||||||
|
|
||||||
# Linux ARM64(仅公开仓库可用)
|
|
||||||
- platform: 'ubuntu-22.04-arm'
|
|
||||||
args: ''
|
|
||||||
|
|
||||||
# Windows x64
|
# Windows x64
|
||||||
- platform: 'windows-latest'
|
- platform: "windows-latest"
|
||||||
args: ''
|
args: ""
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 1. 检出代码
|
# 1. 检出代码
|
||||||
- uses: actions/checkout@v5
|
- name: Checkout
|
||||||
|
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
|
|
||||||
|
|
||||||
# 3. 安装 Node.js
|
# 3. 安装 Node.js
|
||||||
- name: Setup pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v4
|
uses: pnpm/action-setup@v6
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 11
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v5
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
node-version: lts/*
|
||||||
cache: 'pnpm'
|
cache: "pnpm"
|
||||||
cache-dependency-path: pnpm-lock.yaml
|
|
||||||
|
|
||||||
# 4. 安装 Rust
|
# 4. 安装 Rust
|
||||||
- name: Install Rust stable
|
- name: Setup Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
|
||||||
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
|
||||||
|
|
||||||
# 5. Rust 缓存(大幅加速后续构建)
|
# 5. Rust 缓存(大幅加速后续构建)
|
||||||
- name: Rust cache
|
- name: Cache Rust build
|
||||||
uses: swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
workspaces: './src-tauri -> target'
|
workspaces: src-tauri
|
||||||
|
|
||||||
# 6. 安装前端依赖
|
# 6. 安装前端依赖
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# 7. 构建并发布(核心步骤)
|
# 7. 构建并发布(核心步骤)
|
||||||
- uses: tauri-apps/tauri-action@v0
|
- name: Build app & publish release
|
||||||
|
uses: tauri-apps/tauri-action@v0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
tagName: v__VERSION__ # 自动替换为 tauri.conf.json 里的版本号
|
tagName: v__VERSION__ # 自动替换为 tauri.conf.json 里的版本号
|
||||||
releaseName: 'App v__VERSION__'
|
releaseName: "StealthReader v__VERSION__"
|
||||||
releaseBody: 'See the assets to download and install.'
|
releaseBody: "See the assets to download and install."
|
||||||
releaseDraft: true # 先创建草稿,手动确认后再发布
|
releaseDraft: true # 先创建草稿,手动确认后再发布
|
||||||
prerelease: false
|
prerelease: false
|
||||||
args: ${{ matrix.args }}
|
args: ${{ matrix.args }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue