Skip to content

Commit

Permalink
ci(action): 🎡 增加测试分支来测试是否可以正常打包 (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
nongyehong authored Jan 5, 2025
1 parent 64f0c39 commit af3ca51
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 4 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/debug-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Debug Build

on:
workflow_dispatch: # 手动触发
inputs:
platform:
type: choice
description: '选择测试平台'
required: true
default: 'ubuntu-22.04'
options:
- ubuntu-22.04
- macos-latest
- windows-latest

jobs:
debug-build:
runs-on: ${{ inputs.platform }}
steps:
- uses: actions/checkout@v4

- name: Install Ubuntu dependencies
if: inputs.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libudev-dev \
libasound2-dev \
pkg-config \
libgtk-3-dev \
libayatana-appindicator3-dev
# 验证安装的包
dpkg -l | grep -E 'webkit|appindicator|rsvg|udev|asound|gtk'
# 添加环境变量配置
- name: Set up environment variables
run: echo "${{ secrets.ENV_LOCAL_CONTENT }}" > .env.local

# 安装 pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

# 设置 Node.js
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Build Vite + Tauri
run: pnpm build

# 安装 Rust
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ inputs.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'

# 只构建不发布
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
releaseId: "debug-build"
27 changes: 23 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@ name: Release CI
on:
push:
tags:
- 'v*' # 当推送 v 开头的标签时触发
workflow_dispatch: # 允许手动触发工作流
- 'v*'
branches:
- test-actions # 添加测试分支
workflow_dispatch: # 已存在的手动触发
inputs:
debug_enabled:
type: boolean
description: '启用调试模式'
required: false
default: false

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true # 如果有新的发布任务,取消正在进行的任务

jobs:
publish-tauri:
# 添加调试条件
if: ${{ !inputs.debug_enabled }}
permissions:
contents: write # 授予写入仓库内容的权限
strategy:
Expand All @@ -32,10 +42,19 @@ jobs:
- uses: actions/checkout@v4

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # Tauri v2 最低兼容性版本
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 libudev-dev
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libudev-dev \
libasound2-dev \
pkg-config \
libgtk-3-dev \
libayatana-appindicator3-dev
# 添加环境变量配置
- name: Set up environment variables
Expand Down

0 comments on commit af3ca51

Please sign in to comment.