Files
clash-proxy/.github/workflows/dev.yml

110 lines
4.0 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: Development Test
on:
workflow_dispatch:
inputs:
platforms:
description: "选择要运行的平台(逗号分隔,如 windows,macos-aarch64,macos-x86_64"
required: false
default: "windows,macos-aarch64,macos-x86_64"
permissions: write-all
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short
concurrency:
group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
dev:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
bundle: nsis
id: windows
- os: macos-latest
target: aarch64-apple-darwin
bundle: dmg
id: macos-aarch64
- os: macos-latest
target: x86_64-apple-darwin
bundle: dmg
id: macos-x86_64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: actions/checkout@v4
- name: Install Rust Stable
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: dtolnay/rust-toolchain@stable
- name: Add Rust Target
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
run: rustup target add ${{ matrix.target }}
- name: Rust Cache
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
save-if: false
- name: Install Node
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: actions/setup-node@v4
with:
node-version: "20"
- uses: pnpm/action-setup@v4
name: Install pnpm
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
with:
run_install: false
- name: Pnpm install and check
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
run: |
pnpm i
pnpm run prebuild ${{ matrix.target }}
- name: Tauri build
if: contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: tauri-apps/tauri-action@v0
env:
NODE_OPTIONS: "--max_old_space_size=4096"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
tauriScript: pnpm
args: --target ${{ matrix.target }} -b ${{ matrix.bundle }}
- name: Upload Artifacts
if: matrix.os == 'macos-latest' && contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg
if-no-files-found: error
- name: Upload Artifacts
if: matrix.os == 'windows-latest' && contains(github.event.inputs.platforms || 'windows,macos-aarch64,macos-x86_64', matrix.id)
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*.exe
if-no-files-found: error