💄 format

This commit is contained in:
Tw93
2025-08-23 20:49:42 +08:00
parent 34a0419c83
commit ae2c5e0a17
5 changed files with 70 additions and 70 deletions

View File

@@ -1,16 +1,16 @@
name: 'Test Pake Action' name: "Test Pake Action"
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
url: url:
description: 'URL to package' description: "URL to package"
required: true required: true
default: 'https://weekly.tw93.fun' default: "https://weekly.tw93.fun"
name: name:
description: 'App name' description: "App name"
required: true required: true
default: 'TestApp' default: "TestApp"
jobs: jobs:
test: test:
@@ -22,7 +22,7 @@ jobs:
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: '20' node-version: "20"
- name: Build Pake App - name: Build Pake App
id: build id: build

View File

@@ -8,26 +8,26 @@ Transform any webpage into a lightweight desktop app with a single GitHub Action
- name: Build Pake App - name: Build Pake App
uses: tw93/Pake@v3 uses: tw93/Pake@v3
with: with:
url: 'https://example.com' url: "https://example.com"
name: 'MyApp' name: "MyApp"
``` ```
## Inputs ## Inputs
| Parameter | Description | Required | Default | | Parameter | Description | Required | Default |
|-----------|-------------|----------|---------| | ------------ | ------------------------ | -------- | ------- |
| `url` | Target URL to package | ✅ | | | `url` | Target URL to package | ✅ | |
| `name` | Application name | ✅ | | | `name` | Application name | ✅ | |
| `output-dir` | Output directory | | `dist` | | `output-dir` | Output directory | | `dist` |
| `icon` | Custom app icon URL/path | | | | `icon` | Custom app icon URL/path | | |
| `width` | Window width | | `1200` | | `width` | Window width | | `1200` |
| `height` | Window height | | `780` | | `height` | Window height | | `780` |
| `debug` | Enable debug mode | | `false` | | `debug` | Enable debug mode | | `false` |
## Outputs ## Outputs
| Output | Description | | Output | Description |
|--------|-------------| | -------------- | ----------------------------- |
| `package-path` | Path to the generated package | | `package-path` | Path to the generated package |
## Examples ## Examples
@@ -45,8 +45,8 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: tw93/Pake@v3 - uses: tw93/Pake@v3
with: with:
url: 'https://weekly.tw93.fun' url: "https://weekly.tw93.fun"
name: 'WeeklyApp' name: "WeeklyApp"
``` ```
### With Custom Icon ### With Custom Icon
@@ -54,9 +54,9 @@ jobs:
```yaml ```yaml
- uses: tw93/Pake@v3 - uses: tw93/Pake@v3
with: with:
url: 'https://example.com' url: "https://example.com"
name: 'MyApp' name: "MyApp"
icon: 'https://example.com/icon.png' icon: "https://example.com/icon.png"
width: 1400 width: 1400
height: 900 height: 900
``` ```
@@ -74,20 +74,20 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: tw93/Pake@v3 - uses: tw93/Pake@v3
with: with:
url: 'https://example.com' url: "https://example.com"
name: 'CrossPlatformApp' name: "CrossPlatformApp"
``` ```
## How It Works ## How It Works
1. **Auto Setup**: Installs Rust, Node.js dependencies, builds Pake CLI 1. **Auto Setup**: Installs Rust, Node.js dependencies, builds Pake CLI
2. **Build App**: Runs `pake` command with your parameters 2. **Build App**: Runs `pake` command with your parameters
3. **Package Output**: Finds and moves the generated package to output directory 3. **Package Output**: Finds and moves the generated package to output directory
## Supported Platforms ## Supported Platforms
- **Linux**: `.deb` packages (Ubuntu runners) - **Linux**: `.deb` packages (Ubuntu runners)
- **macOS**: `.app` and `.dmg` packages (macOS runners) - **macOS**: `.app` and `.dmg` packages (macOS runners)
- **Windows**: `.exe` and `.msi` packages (Windows runners) - **Windows**: `.exe` and `.msi` packages (Windows runners)
Use GitHub's matrix strategy to build for multiple platforms simultaneously. Use GitHub's matrix strategy to build for multiple platforms simultaneously.

View File

@@ -1,101 +1,101 @@
name: 'Pake Web App Builder' name: "Pake Web App Builder"
description: 'Transform any webpage into a lightweight desktop app using Rust and Tauri' description: "Transform any webpage into a lightweight desktop app using Rust and Tauri"
author: 'tw93' author: "tw93"
branding: branding:
icon: 'package' icon: "package"
color: 'blue' color: "blue"
inputs: inputs:
url: url:
description: 'Target URL to package' description: "Target URL to package"
required: true required: true
name: name:
description: 'Application name' description: "Application name"
required: true required: true
output-dir: output-dir:
description: 'Output directory for packages' description: "Output directory for packages"
required: false required: false
default: 'dist' default: "dist"
icon: icon:
description: 'Custom app icon URL or path' description: "Custom app icon URL or path"
required: false required: false
width: width:
description: 'Window width' description: "Window width"
required: false required: false
default: '1200' default: "1200"
height: height:
description: 'Window height' description: "Window height"
required: false required: false
default: '780' default: "780"
debug: debug:
description: 'Enable debug mode' description: "Enable debug mode"
required: false required: false
default: 'false' default: "false"
outputs: outputs:
package-path: package-path:
description: 'Path to the generated package' description: "Path to the generated package"
runs: runs:
using: 'composite' using: "composite"
steps: steps:
- name: Setup Environment - name: Setup Environment
shell: bash shell: bash
run: | run: |
# Install Node.js dependencies # Install Node.js dependencies
npm install npm install
# Build Pake CLI if not exists # Build Pake CLI if not exists
if [ ! -f "dist/cli.js" ]; then if [ ! -f "dist/cli.js" ]; then
npm run cli:build npm run cli:build
fi fi
# Ensure node is accessible in subsequent steps # Ensure node is accessible in subsequent steps
echo "$(npm bin)" >> $GITHUB_PATH echo "$(npm bin)" >> $GITHUB_PATH
# Install Rust/Cargo if needed # Install Rust/Cargo if needed
if ! command -v cargo &> /dev/null; then if ! command -v cargo &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source ~/.cargo/env source ~/.cargo/env
echo "$HOME/.cargo/bin" >> $GITHUB_PATH echo "$HOME/.cargo/bin" >> $GITHUB_PATH
fi fi
- name: Build Pake App - name: Build Pake App
shell: bash shell: bash
run: | run: |
# Build arguments # Build arguments
ARGS=("${{ inputs.url }}") ARGS=("${{ inputs.url }}")
ARGS+=("--name" "${{ inputs.name }}") ARGS+=("--name" "${{ inputs.name }}")
if [ -n "${{ inputs.icon }}" ]; then if [ -n "${{ inputs.icon }}" ]; then
ARGS+=("--icon" "${{ inputs.icon }}") ARGS+=("--icon" "${{ inputs.icon }}")
fi fi
ARGS+=("--width" "${{ inputs.width }}") ARGS+=("--width" "${{ inputs.width }}")
ARGS+=("--height" "${{ inputs.height }}") ARGS+=("--height" "${{ inputs.height }}")
if [ "${{ inputs.debug }}" == "true" ]; then if [ "${{ inputs.debug }}" == "true" ]; then
ARGS+=("--debug") ARGS+=("--debug")
fi fi
# Create output directory # Create output directory
mkdir -p "${{ inputs.output-dir }}" mkdir -p "${{ inputs.output-dir }}"
export PAKE_CREATE_APP=1 export PAKE_CREATE_APP=1
# Run Pake CLI # Run Pake CLI
echo "🔧 Running: node dist/cli.js ${ARGS[*]}" echo "🔧 Running: node dist/cli.js ${ARGS[*]}"
node dist/cli.js "${ARGS[@]}" node dist/cli.js "${ARGS[@]}"
# Find generated package and set output # Find generated package and set output
PACKAGE=$(find src-tauri/target -type f \( -name "*.deb" -o -name "*.exe" -o -name "*.msi" -o -name "*.dmg" \) 2>/dev/null | head -1) PACKAGE=$(find src-tauri/target -type f \( -name "*.deb" -o -name "*.exe" -o -name "*.msi" -o -name "*.dmg" \) 2>/dev/null | head -1)
# If no file packages found, look for .app directory (macOS) # If no file packages found, look for .app directory (macOS)
if [ -z "$PACKAGE" ]; then if [ -z "$PACKAGE" ]; then
PACKAGE=$(find src-tauri/target -type d -name "*.app" 2>/dev/null | head -1) PACKAGE=$(find src-tauri/target -type d -name "*.app" 2>/dev/null | head -1)
@@ -109,4 +109,4 @@ runs:
else else
echo "❌ No package found" echo "❌ No package found"
exit 1 exit 1
fi fi

2
bin/cli.ts vendored
View File

@@ -151,7 +151,7 @@ program
if (!url) { if (!url) {
program.help({ program.help({
error: false error: false,
}); });
return; return;
} }

View File

@@ -319,8 +319,8 @@ StartupNotify=true
tauriConf.app.security = { tauriConf.app.security = {
headers: { headers: {
'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp' 'Cross-Origin-Embedder-Policy': 'require-corp',
} },
}; };
} }