Files
Pake/.github/workflows/single-app.yaml
2025-08-26 15:47:04 +08:00

174 lines
5.2 KiB
YAML
Vendored

name: Build Single Popular App
on:
workflow_dispatch:
inputs:
name:
description: "App Name"
required: true
default: "twitter"
title:
description: "App Title"
required: true
default: "Twitter"
name_zh:
description: "App Name in Chinese"
required: true
default: "推特"
url:
description: "App URL"
required: true
default: "https://twitter.com/"
workflow_call:
inputs:
name:
description: "App Name"
type: string
required: true
default: "twitter"
title:
description: "App Title"
required: true
type: string
default: "Twitter"
name_zh:
description: "App Name in Chinese"
required: true
type: string
default: "推特"
url:
description: "App URL"
required: true
type: string
default: "https://twitter.com/"
jobs:
build:
name: ${{ inputs.title }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-latest
rust: stable
target: x86_64-unknown-linux-musl
- build: windows
os: windows-latest
rust: stable-x86_64-msvc
target: x86_64-pc-windows-msvc
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.15.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
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
- name: Rust cache restore
uses: actions/cache/restore@v4.2.0
id: cache_store
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Config App
env:
NAME: ${{ inputs.name }}
TITLE: ${{ inputs.title }}
NAME_ZH: ${{ inputs.name_zh }}
URL: ${{ inputs.url }}
run: |
pnpm install --frozen-lockfile
pnpm run build:config
- name: Add Rust targets for macOS universal build
if: matrix.os == 'macos-latest'
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Build for Linux
if: matrix.os == 'ubuntu-latest'
timeout-minutes: 15
run: |
pnpm run tauri build
mkdir -p output/linux
mv src-tauri/target/release/bundle/deb/*.deb output/linux/${{inputs.title}}_`arch`.deb
mv src-tauri/target/release/bundle/appimage/*.AppImage output/linux/"${{inputs.title}}"_`arch`.AppImage
- name: Build for macOS
if: matrix.os == 'macos-latest'
timeout-minutes: 20
run: |
pnpm run tauri build -- --target universal-apple-darwin
mkdir -p output/macos
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/"${{inputs.title}}".dmg
- name: Build for Windows
if: matrix.os == 'windows-latest'
timeout-minutes: 15
run: |
pnpm run tauri build -- --target x86_64-pc-windows-msvc
New-Item -Path "output\windows" -ItemType Directory
Move-Item -Path "src-tauri\target\x86_64-pc-windows-msvc\release\bundle\msi\*.msi" -Destination "output\windows\${{inputs.title}}_x64.msi"
git checkout -- src-tauri/Cargo.lock
- name: Rust cache store
uses: actions/cache/save@v4.2.0
if: steps.cache_store.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.title }}-${{ matrix.build }}
path: output/*/*.*
retention-days: 3
- name: Upload to release
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
allowUpdates: true
artifacts: "output/*/*.*"
token: ${{ secrets.GITHUB_TOKEN }}