-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(build): use pake instead of nativefier
- Loading branch information
1 parent
adc4cc0
commit 59654b4
Showing
2 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
name: Build App (Pake) | ||
on: | ||
push: | ||
inputs: | ||
name: | ||
default: 'monopoly' | ||
type: string | ||
title: | ||
description: 'app title' | ||
default: 'Monopoly' | ||
type: string | ||
url: | ||
description: 'app url' | ||
default: 'https://monopoly.streamlit.app/' | ||
workflow_call: | ||
inputs: | ||
name: | ||
default: 'monopoly' | ||
type: string | ||
title: | ||
description: 'app title' | ||
default: 'Monopoly' | ||
type: string | ||
url: | ||
description: 'app url' | ||
default: 'https://monopoly.streamlit.app/' | ||
type: string | ||
|
||
jobs: | ||
build_app: | ||
name: ${{ inputs.title }} (${{ matrix.os }}) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
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 dependencies (ubuntu only) | ||
if: matrix.os == 'ubuntu-latest' | ||
uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra | ||
version: 1.1 | ||
|
||
- name: Rust cache restore | ||
id: cache_store | ||
uses: actions/cache/restore@v3 | ||
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 }} | ||
URL: ${{ inputs.url }} | ||
run: | | ||
npm install | ||
npm run build:config | ||
- name: Build for Ubuntu | ||
if: matrix.os == 'ubuntu-latest' | ||
run: | | ||
npm 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' | ||
run: | | ||
rustup target add aarch64-apple-darwin | ||
rustup target add x86_64-apple-darwin | ||
npm 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' | ||
run: | | ||
npm 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" | ||
- name: Restore Cargo Lock File(Windows Only) | ||
if: matrix.os == 'windows-latest' | ||
run: | | ||
git checkout -- src-tauri/Cargo.lock | ||
- name: Rust cache store | ||
uses: actions/cache/save@v3 | ||
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 For Single Build | ||
uses: actions/upload-artifact@v3 | ||
if: startsWith(github.ref, 'refs/tags/') != true | ||
with: | ||
path: 'output/*/*.*' | ||
|
||
- name: Upload For Release | ||
# arg info: https://github.com/ncipollo/release-action#release-action | ||
uses: ncipollo/release-action@v1 | ||
if: startsWith(github.ref, 'refs/tags/') == true | ||
with: | ||
allowUpdates: true | ||
artifacts: 'output/*/*.*' | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"name": "pake-cli", | ||
"version": "2.5.1", | ||
"description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。", | ||
"engines": { | ||
"node": ">=16.0.0" | ||
}, | ||
"bin": { | ||
"pake": "./cli.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tw93/pake.git" | ||
}, | ||
"author": { | ||
"name": "Tw93", | ||
"email": "[email protected]" | ||
}, | ||
"keywords": [ | ||
"pake", | ||
"pake-cli", | ||
"rust", | ||
"tauri", | ||
"no-electron", | ||
"productivity" | ||
], | ||
"files": [ | ||
"dist", | ||
"src-tauri", | ||
"cli.js" | ||
], | ||
"scripts": { | ||
"start": "npm run dev", | ||
"dev": "npm run tauri dev", | ||
"build": "npm run tauri build --release", | ||
"build:debug": "npm run tauri build -- --debug", | ||
"build:mac": "npm run tauri build -- --target universal-apple-darwin", | ||
"build:config": "chmod +x script/app_config.mjs && node script/app_config.mjs", | ||
"analyze": "cd src-tauri && cargo bloat --release --crates", | ||
"tauri": "tauri", | ||
"cli": "rollup -c rollup.config.js --watch", | ||
"cli:dev": "cross-env NODE_ENV=development rollup -c rollup.config.js -w", | ||
"cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js", | ||
"prepublishOnly": "npm run cli:build" | ||
}, | ||
"type": "module", | ||
"exports": "./dist/pake.js", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@tauri-apps/api": "^1.5.4", | ||
"@tauri-apps/cli": "^1.5.13", | ||
"axios": "^1.6.8", | ||
"chalk": "^5.3.0", | ||
"commander": "^11.1.0", | ||
"file-type": "^18.7.0", | ||
"fs-extra": "^11.2.0", | ||
"is-url": "^1.2.4", | ||
"loglevel": "^1.9.1", | ||
"ora": "^7.0.1", | ||
"prompts": "^2.4.2", | ||
"psl": "^1.9.0", | ||
"shelljs": "^0.8.5", | ||
"tmp-promise": "^3.0.3", | ||
"update-notifier": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-alias": "^5.1.0", | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-json": "^6.1.0", | ||
"@rollup/plugin-replace": "^5.0.5", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@types/fs-extra": "^11.0.4", | ||
"@types/is-url": "^1.2.32", | ||
"@types/node": "^20.12.10", | ||
"@types/page-icon": "^0.3.6", | ||
"@types/prompts": "^2.4.9", | ||
"@types/psl": "^1.1.3", | ||
"@types/shelljs": "^0.8.15", | ||
"@types/tmp": "^0.2.6", | ||
"@types/update-notifier": "^6.0.8", | ||
"app-root-path": "^3.1.0", | ||
"cross-env": "^7.0.3", | ||
"rollup": "^4.17.2", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"tslib": "^2.6.2", | ||
"typescript": "^5.4.5" | ||
} | ||
} |