Files
Pake/.github/workflows/pake-cli.yaml
2025-03-01 21:54:45 +08:00

166 lines
4.9 KiB
YAML
Vendored

name: Build App With Pake CLI
on:
workflow_dispatch:
inputs:
platform:
description: 'Platform'
required: true
default: 'ubuntu-22.04'
type: choice
options:
- 'windows-latest'
- 'macos-latest'
- 'ubuntu-22.04'
url:
description: 'URL'
required: true
name:
description: 'Name, English, Linux no capital'
required: true
icon:
description: 'Icon, Image URL, Optional'
required: false
width:
description: 'Width, Optional'
required: false
default: '1200'
height:
description: 'Height, Optional'
required: false
default: '780'
fullscreen:
description: 'Fullscreen, At startup, Optional'
required: false
type: boolean
default: false
hide_title_bar:
description: 'Hide TitleBar, MacOS only, Optional'
required: false
type: boolean
default: false
multi_arch:
description: 'MultiArch, MacOS only, Optional'
required: false
type: boolean
default: false
targets:
description: 'Targets, Linux only, Optional'
required: false
default: 'deb'
type: choice
options:
- 'deb'
- 'appimage'
- 'rpm'
jobs:
build:
name: ${{ inputs.platform }}
runs-on: ${{ inputs.platform }}
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Rust for ubuntu-22.04
if: inputs.platform == 'ubuntu-22.04'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
- name: Install Rust for windows-latest
if: inputs.platform == 'windows-latest'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable-x86_64-msvc
target: x86_64-pc-windows-msvc
- name: Install Rust for macos-latest
if: inputs.platform == 'macos-latest'
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: x86_64-apple-darwin
- name: Install dependencies (Ubuntu only)
if: inputs.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2.2-dev libglib2.0-dev
- name: Set PKG_CONFIG_PATH (Ubuntu only)
if: inputs.platform == 'ubuntu-22.04'
run: |
export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV
- name: Verify glib-2.0 installation (Ubuntu only)
if: inputs.platform == 'ubuntu-22.04'
run: |
pkg-config --modversion glib-2.0
- name: Install pake-cli locally
shell: bash
run: |
echo "Installing pake-cli locally"
npm install pake-cli
- name: Restore Rust cache
uses: actions/cache/restore@v3
id: cache_restore
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
node_modules/pake-cli/src-tauri/target/
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
- name: Install additional dependencies
run: |
npm install shelljs
npm install axios
- name: Build with pake-cli
run: |
node ./script/build_with_pake_cli.js
env:
URL: ${{ inputs.url }}
NAME: ${{ inputs.name }}
ICON: ${{ inputs.icon }}
HEIGHT: ${{ inputs.height }}
WIDTH: ${{ inputs.width }}
HIDE_TITLE_BAR: ${{ inputs.hide_title_bar }}
FULLSCREEN: ${{ inputs.fullscreen }}
MULTI_ARCH: ${{ inputs.multi_arch }}
TARGETS: ${{ inputs.targets }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: output-${{ inputs.platform }}.zip
path: node_modules/pake-cli/output/*
retention-days: 3
- name: Save Rust cache
uses: actions/cache/save@v3
if: steps.cache_restore.outputs.cache-hit != 'true'
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
node_modules/pake-cli/src-tauri/target/
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}