🎨 Refactoring action packaging logic

This commit is contained in:
Tw93
2023-08-28 18:48:56 +08:00
parent b5ad835f50
commit b512384427
5 changed files with 20 additions and 117 deletions

View File

@@ -1,4 +1,4 @@
name: Build Popular App
name: Build All Popular Apps
on:
push:
tags:

View File

@@ -3,43 +3,43 @@ on:
workflow_dispatch:
inputs:
name:
description: "app name"
description: 'app name'
required: true
default: "twitter"
default: 'twitter'
title:
description: "app title"
description: 'app title'
required: true
default: "Twitter"
default: 'Twitter'
name_zh:
description: "app name in Chinese"
description: 'app name in Chinese'
required: true
default: "推特"
default: '推特'
url:
description: "app url"
description: 'app url'
required: true
default: "https://twitter.com/"
default: 'https://twitter.com/'
workflow_call:
inputs:
name:
description: "app name"
description: 'app name'
type: string
required: true
default: "twitter"
default: 'twitter'
title:
description: "app title"
description: 'app title'
required: true
type: string
default: "Twitter"
default: 'Twitter'
name_zh:
description: "app name in Chinese"
description: 'app name in Chinese'
required: true
type: string
default: "推特"
default: '推特'
url:
description: "app url"
description: 'app url'
required: true
type: string
default: "https://twitter.com/"
default: 'https://twitter.com/'
jobs:
build_single_app:
@@ -98,8 +98,7 @@ jobs:
URL: ${{ inputs.url }}
run: |
npm install
npm run build:app:config
node ./script/build_with_pake_cli.mjs
- name: Build for Ubuntu
if: matrix.os == 'ubuntu-latest'
@@ -109,7 +108,6 @@ jobs:
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: |
@@ -119,7 +117,6 @@ jobs:
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: |
@@ -143,12 +140,11 @@ jobs:
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/*/*.*"
path: 'output/*/*.*'
- name: Upload For Release
# arg info: https://github.com/ncipollo/release-action#release-action
@@ -156,5 +152,5 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') == true
with:
allowUpdates: true
artifacts: "output/*/*.*"
artifacts: 'output/*/*.*'
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -33,7 +33,6 @@
"start": "npm run dev",
"dev": "npm run tauri dev",
"build": "npm run tauri build --release",
"build:app:config": "chmod +x ./script/app_config.mjs && node ./script/app_config.mjs",
"build:debug": "npm run tauri build -- --debug",
"build:mac": "npm run tauri build -- --target universal-apple-darwin",
"analyze": "cd src-tauri && cargo bloat --release --crates",

View File

@@ -1,92 +0,0 @@
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 "resize: " $env:RESIZE
Write-Host "is multi arch? only for Mac: " $env:MULTI_ARCH
Write-Host "targets type? only for Linux: " $env:TARGETS
Write-Host "===========================`n"
Set-Location node_modules/pake-cli
# init params
${Params}="node cli.js $env:URL --name $env:NAME"
# download icon
if ((($null -ne $env:ICON) -and ($env:ICON -ne ""))){
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"
}
# resize
if ("$env:FULLSCREEN" -eq "true" ) {
${Params}="${Params} --resize"
}
# multi-arch only for mac
if (($env:MULTI_ARCH -eq "true") -and ($IsMacOS)) {
rustup target add aarch64-apple-darwin
${Params}="${Params} --multi-arch"
}
# targets type, only for linux
if (($null -ne $env:TARGETS) -and ($env:TARGETS -ne "") -and ($IsLinux)) {
${Params}="${Params} --targets $env:TARGETS"
}
# add systemTray for Window / Linux default
if ($IsWindows) {
${Params}="${Params} --show-system-tray"
}
if ($IsLinux) {
${Params}="${Params} --show-system-tray"
}
# add menu for MacOS default
if ($IsMacOS) {
${Params}="${Params} --show-menu"
}
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"
Set-Location ../..