diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yaml new file mode 100644 index 0000000..084555c --- /dev/null +++ b/.github/workflows/pake-cli.yaml @@ -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') }} diff --git a/script/build_with_pake_cli.ps1 b/script/build_with_pake_cli.ps1 new file mode 100644 index 0000000..35377cd --- /dev/null +++ b/script/build_with_pake_cli.ps1 @@ -0,0 +1,75 @@ +Write-Host "Welcome to use Powershell" +Write-Host "`n=======================" +Write-Host "build for windows" +Write-Host "make ture powershell == 7.2.10" +Write-Host "powershell 7.2.10 download url: https://github.com/PowerShell/PowerShell/releases/tag/v7.2.10" +Write-Host "Powershell info in your localhost " +$PSVersionTable +Write-Host "`n=======================`n" + +Write-Host "`n=======================" +Write-Host "pake parameters is: " +Write-Host "url: " $env:URL +Write-Host "name: " $env:NAME +Write-Host "icon: " $env:ICON +Write-Host "height: " $env:HEIGHT +Write-Host "width: " $env:WIDTH +Write-Host "transparent: " $env:TRANSPARENT +Write-Host "fullscreen: " $env:FULLSCREEN +Write-Host "resize: " $env:RESIZE +Write-Host "is multi arch? only for Mac: " $env:MULTI_ARCH +Write-Host "===========================`n" + +# init params +${Params}="node node_modules/pake-cli/cli.js $env:URL --name $env:NAME" + +# download icon +if (($null -eq $env:URL) -or ($env:URL -eq "")){ + if ($IsLinux) { + curl -L "$env:ICON" -o icon.png + ${Params}="${Params} --icon icon.png" + } elseif ($IsMacOS) { + curl -L "$env:ICON" -o icon.icns + ${Params}="${Params} --icon icon.icns" + } elseif ($IsWindows) { + curl -L "$env:ICON" -o icon.ico + ${Params}="${Params} --icon icon.ico" + } else { + Write-Host "it won't download icon, becase it can't detect you OS system!" + } +} + +# height && weight +${Params}="${Params} --height $env:HEIGHT --width $env:WIDTH" + +# transparent +if ("$env:TRANSPARENT" -eq "true") { + ${Params}="${Params} --transparent" +} + +# fullscreen +if ("$env:FULLSCREEN" -eq "true") { + ${Params}="${Params} --fullscreen" +} + +# resize +if ("$env:FULLSCREEN" -eq "true" ) { + ${Params}="${Params} --resize" +} + +# multi-arch +if ($env:MULTI_ARCH -eq "true") { + rustup target add aarch64-apple-darwin + ${Params}="${Params} --multi-arch" +} + +Write-Host "Pake parameters is: ${Params}" +Write-Host "compile...." +Invoke-Expression $Params + +# output +if (-not(Test-Path output)) { + New-Item -ItemType Directory -Path "output" +} +Move-Item -Path "$env:NAME.*" -Destination "output/" +Write-Host "Build Success" diff --git a/src-tauri/assets/com-tw93-weread.desktop b/src-tauri/assets/com-tw93-weread.desktop deleted file mode 100644 index 0978834..0000000 --- a/src-tauri/assets/com-tw93-weread.desktop +++ /dev/null @@ -1,10 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Categories=Office -Exec=com-tw93-weread -Icon=com-tw93-weread -Name=com-tw93-weread -Name[zh_CN]=微信阅读 -StartupNotify=true -Terminal=false -Type=Application diff --git a/src-tauri/assets/main.wxs b/src-tauri/assets/main.wxs deleted file mode 100644 index 4b92bd7..0000000 --- a/src-tauri/assets/main.wxs +++ /dev/null @@ -1,310 +0,0 @@ - - - - - - - - - - - - - - - - - - - - {{#if allow_downgrades}} - - {{else}} - - {{/if}} - - - Installed AND NOT UPGRADINGPRODUCTCODE - - - - - {{#if banner_path}} - - {{/if}} - {{#if dialog_image_path}} - - {{/if}} - {{#if license}} - - {{/if}} - - - - - - - - - - - - - - - - - - - WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed - - - - {{#unless license}} - - 1 - 1 - {{/unless}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {{#each binaries as |bin| ~}} - - - - {{/each~}} - {{#if enable_elevated_update_task}} - - - - - - - - - - {{/if}} - {{{resources}}} - - - - - - - - - - - - - - - - - - - - - {{#each merge_modules as |msm| ~}} - - - - - - - - {{/each~}} - - - - - - {{#each resource_file_ids as |resource_file_id| ~}} - - {{/each~}} - - {{#if enable_elevated_update_task}} - - - - {{/if}} - - - - - - - - - - - {{#each binaries as |bin| ~}} - - {{/each~}} - - - - - {{#each component_group_refs as |id| ~}} - - {{/each~}} - {{#each component_refs as |id| ~}} - - {{/each~}} - {{#each feature_group_refs as |id| ~}} - - {{/each~}} - {{#each feature_refs as |id| ~}} - - {{/each~}} - {{#each merge_refs as |id| ~}} - - {{/each~}} - - - {{#if install_webview}} - - - - - - - {{#if download_bootstrapper}} - - - - - - - {{/if}} - - - {{#if webview2_bootstrapper_path}} - - - - - - - - {{/if}} - - - {{#if webview2_installer_path}} - - - - - - - - {{/if}} - - {{/if}} - - {{#if enable_elevated_update_task}} - - - - - NOT(REMOVE) - - - - - - - (REMOVE = "ALL") AND NOT UPGRADINGPRODUCTCODE - - - {{/if}} - - - -