Skip to content

Build App With Pake CLI #173

Build App With Pake CLI

Build App With Pake CLI #173

Workflow file for this run

name: Build App With Pake CLI
env:
NODE_VERSION: "22"
PNPM_VERSION: "10.26.2"
on:
workflow_dispatch:
inputs:
platform:
description: "Platform"
required: true
default: "macos-latest"
type: choice
options:
- "windows-latest"
- "macos-latest"
- "ubuntu-24.04"
url:
description: "Website URL"
required: true
name:
description: "App name (lowercase for Linux)"
required: true
icon:
description: "Icon URL, auto-fetch if empty"
required: false
width:
description: "Window width (px)"
required: false
default: "1200"
height:
description: "Window height (px)"
required: false
default: "780"
fullscreen:
description: "Start in fullscreen mode"
required: false
type: boolean
default: false
hide_title_bar:
description: "Hide title bar (macOS only)"
required: false
type: boolean
default: false
multi_arch:
description: "Universal binary (macOS only)"
required: false
type: boolean
default: false
targets:
description: "Package formats (comma-separated: deb,appimage,rpm)"
required: false
default: "deb"
jobs:
build:
name: ${{ inputs.platform }}
runs-on: ${{ inputs.platform }}
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Setup Node.js Environment
uses: ./.github/actions/setup-env
with:
mode: build
- name: Build CLI
run: pnpm run cli:build
- name: Setup mold linker
if: runner.os == 'Linux'
uses: rui314/setup-mold@v1
- 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-pake-${{ hashFiles('**/Cargo.lock') }}
- name: Build App (Linux/macOS)
if: runner.os != 'Windows'
timeout-minutes: 25
shell: bash
run: |
ARGS="${{ inputs.url }} --name ${{ inputs.name }}"
if [ -n "${{ inputs.icon }}" ]; then
ARGS="$ARGS --icon ${{ inputs.icon }}"
fi
if [ -n "${{ inputs.width }}" ]; then
ARGS="$ARGS --width ${{ inputs.width }}"
fi
if [ -n "${{ inputs.height }}" ]; then
ARGS="$ARGS --height ${{ inputs.height }}"
fi
if [ "${{ inputs.fullscreen }}" == "true" ]; then
ARGS="$ARGS --fullscreen"
fi
if [ "${{ inputs.hide_title_bar }}" == "true" ]; then
ARGS="$ARGS --hide-title-bar"
fi
if [ "${{ inputs.multi_arch }}" == "true" ]; then
ARGS="$ARGS --multi-arch"
fi
if [ -n "${{ inputs.targets }}" ] && [ "${{ runner.os }}" == "Linux" ]; then
ARGS="$ARGS --targets ${{ inputs.targets }}"
fi
echo "Running: node dist/cli.js $ARGS"
node dist/cli.js $ARGS
mkdir -p output
# Move generated packages to output directory
if [ "${{ runner.os }}" == "macOS" ]; then
if [ -f "${{ inputs.name }}.dmg" ]; then
# Ad-hoc sign the DMG to reduce quarantine issues
echo "Signing DMG file..."
codesign --force --sign - "${{ inputs.name }}.dmg"
mv "${{ inputs.name }}.dmg" output/
fi
# Create usage instructions for Artifacts downloads
cat > output/README.txt << 'EOF'
Important: If you downloaded this from GitHub Actions Artifacts
If the DMG shows a "damaged" error, run this in Terminal:
xattr -cr /path/to/downloaded.dmg
Then open the DMG file normally.
EOF
elif [ "${{ runner.os }}" == "Linux" ]; then
if [ -f "${{ inputs.name }}.deb" ]; then
mv "${{ inputs.name }}.deb" output/
fi
if [ -f "${{ inputs.name }}.AppImage" ]; then
mv "${{ inputs.name }}.AppImage" output/
fi
fi
- name: Build App (Windows)
if: runner.os == 'Windows'
timeout-minutes: 25
shell: pwsh
run: |
$args = "${{ inputs.url }}", "--name", "${{ inputs.name }}"
if ("${{ inputs.icon }}" -ne "") {
$args += "--icon", "${{ inputs.icon }}"
}
if ("${{ inputs.width }}" -ne "") {
$args += "--width", "${{ inputs.width }}"
}
if ("${{ inputs.height }}" -ne "") {
$args += "--height", "${{ inputs.height }}"
}
if ("${{ inputs.fullscreen }}" -eq "true") {
$args += "--fullscreen"
}
if ("${{ inputs.hide_title_bar }}" -eq "true") {
$args += "--hide-title-bar"
}
Write-Host "Running: node dist/cli.js $($args -join ' ')"
node dist/cli.js $args
New-Item -Path "output" -ItemType Directory -Force
# Move generated package to output directory
if (Test-Path "${{ inputs.name }}.msi") {
Move-Item -Path "${{ inputs.name }}.msi" -Destination "output/"
}
git checkout -- src-tauri/Cargo.lock
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}-${{ runner.os }}
path: output/*
retention-days: 3
- 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-pake-${{ hashFiles('**/Cargo.lock') }}