Add a new online packaging solution, use the form to execute github actions, and reduce the difficulty of packaging.

This commit is contained in:
Tlntin
2023-03-08 22:14:17 +08:00
parent 8f517769c9
commit 54ebb32ce5
4 changed files with 226 additions and 320 deletions

151
.github/workflows/pake-cli.yaml vendored Normal file
View File

@@ -0,0 +1,151 @@
name: build app with pake-cli
on:
workflow_dispatch:
inputs:
platform:
description: "platform"
required: true
default: "macos-latest"
type: choice
options:
- "windows-latest"
- "macos-latest"
- "ubuntu-20.04"
url:
description: "[URL]The url link is the link to the website you want to package"
required: true
name:
description: "[Name]The name of your application. We will prompt you to enter this if you do not provide it in this phase. Input must be in English."
required: true
icon:
description: "[Icon, Optional] Application icon, need to provide a url link, Mac needs icns format, Windows needs (256*256 pixels) ico format, Linux needs (512*512 pixels) png format."
required: false
height:
description: "[Height, Optional]The height of the packaged application window."
required: false
default: "780"
width:
description: "[Width, Optional]The width of the packaged application window. "
required: false
default: "1200"
transparent:
description: "[Transparent, Optional]Whether to enable the immersive header."
required: false
type: boolean
default: false
fullscreen:
description: "[FullScreen, Optional]Indicates if the window should be full screen on application launch. "
required: false
type: boolean
default: false
resize:
description: "[Resize, Optional]Indicates if the window can be resized."
required: false
type: boolean
default: true
multi_arch:
description: "[MultiArch, Optional]Package results support both Intel and m1 chips, only for MacOS. "
required: false
type: boolean
default: false
jobs:
build:
name: ${{ inputs.platform }}
runs-on: ${{ inputs.platform }}
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: install node
uses: actions/setup-node@v1
with:
node-version: 18
- name: Install Rust for ubuntu-20.04
if: inputs.platform == 'ubuntu-20.04'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-unknown-linux-musl
- name: Install Rust for windows-latest
if: inputs.platform == 'windows-latest'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-x86_64-msvc
profile: minimal
override: true
target: x86_64-pc-windows-msvc
- name: Install Rust for macos-latest
if: inputs.platform == 'macos-latest'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
target: x86_64-apple-darwin
- name: install dependencies (ubuntu only)
if: inputs.platform == 'ubuntu-20.04'
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: install pake-cli local
shell: bash
run: |
echo "install pake on local"
npm install pake-cli
- name: rust cache restore
uses: actions/cache/restore@v3
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: build with pake-cli
shell: pwsh
run: |
pwsh ./script/build_with_pake_cli.ps1
env:
URL: ${{ inputs.url }}
NAME: ${{ inputs.name }}
ICON: ${{ inputs.icon }}
HEIGHT: ${{ inputs.height }}
WIDTH: ${{ inputs.width }}
TRANSPARENT: ${{ inputs.transparent }}
FULLSCREEN: ${{ inputs.fullscreen }}
RESIZE: ${{ inputs.resize }}
MULTI_ARCH: ${{ inputs.multi_arch }}
- name: Upload archive
uses: actions/upload-artifact@v3
with:
name: output-${{ inputs.platform }}.zip
path: output/
retention-days: 3
- name: rust cache store
uses: actions/cache/save@v3
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') }}