🎨 Refactoring actions

This commit is contained in:
Tw93
2025-08-29 17:30:37 +08:00
parent ceeb2341e8
commit 1b94adc2a3
8 changed files with 224 additions and 186 deletions

31
.github/actions/setup-node.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Setup Node.js Environment
description: Install Node.js and pnpm with caching
inputs:
node-version:
description: Node.js version to install
required: false
default: '22'
pnpm-version:
description: pnpm version to install
required: false
default: '10.15.0'
runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
- name: Install dependencies
shell: bash
run: pnpm install --frozen-lockfile

40
.github/actions/setup-rust-cache.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: Setup Rust Cache
description: Setup Rust dependency caching with restore and save
inputs:
save-cache:
description: Whether to save cache after build
required: false
default: 'false'
outputs:
cache-hit:
description: Whether cache was restored successfully
value: ${{ steps.cache_restore.outputs.cache-hit }}
runs:
using: composite
steps:
- name: Rust cache restore
uses: actions/cache/restore@v4.2.0
id: cache_restore
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Rust cache save
if: inputs.save-cache == 'true'
uses: actions/cache/save@v4.2.0
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

45
.github/actions/setup-rust.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Setup Rust Environment
description: Install and configure Rust toolchain with platform-specific targets
inputs:
platform:
description: Platform to setup Rust for
required: true
components:
description: Additional Rust components to install
required: false
default: ''
runs:
using: composite
steps:
- name: Install Rust for Linux
if: contains(inputs.platform, 'ubuntu')
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
components: ${{ inputs.components }}
- name: Install Rust for Windows
if: contains(inputs.platform, 'windows')
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable-x86_64-msvc
target: x86_64-pc-windows-msvc
components: ${{ inputs.components }}
- name: Install Rust for macOS
if: contains(inputs.platform, 'macos')
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-apple-darwin
components: ${{ inputs.components }}
- name: Add macOS universal targets
if: contains(inputs.platform, 'macos')
shell: bash
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin

11
.github/actions/setup-ubuntu-deps.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
name: Setup Ubuntu Dependencies
description: Install system dependencies required for Tauri on Ubuntu
runs:
using: composite
steps:
- name: Install Ubuntu system dependencies
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
with:
packages: libdbus-1-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
version: 1.1

21
.github/actions/setup-windows.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
name: Setup Windows Environment
description: Install WIX Toolset and other Windows-specific dependencies
runs:
using: composite
steps:
- name: Install WIX Toolset
shell: powershell
run: |
# Download and install WIX Toolset v3.11
Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311.exe" -OutFile "wix311.exe"
Start-Process -FilePath "wix311.exe" -ArgumentList "/quiet" -Wait
# Add WIX to PATH
$wixPath = "${env:ProgramFiles(x86)}\WiX Toolset v3.11\bin"
if (Test-Path $wixPath) {
echo $wixPath >> $env:GITHUB_PATH
echo "WIX Toolset installed successfully"
} else {
echo "Warning: WIX installation path not found"
}