🎨 update github actions performance
This commit is contained in:
4
.github/workflows/pake-cli.yaml
vendored
4
.github/workflows/pake-cli.yaml
vendored
@@ -68,7 +68,7 @@ jobs:
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'npm'
|
||||
cache: "npm"
|
||||
|
||||
- name: Install Rust for ubuntu-24.04
|
||||
if: inputs.platform == 'ubuntu-24.04'
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
with:
|
||||
toolchain: stable
|
||||
target: x86_64-apple-darwin
|
||||
|
||||
|
||||
- name: Add additional Rust target for multi-arch
|
||||
if: inputs.platform == 'macos-latest' && inputs.multi_arch == true
|
||||
run: |
|
||||
|
||||
23
.github/workflows/pake_build_single_app.yaml
vendored
23
.github/workflows/pake_build_single_app.yaml
vendored
@@ -77,6 +77,16 @@ jobs:
|
||||
node-version: 22
|
||||
cache: "npm"
|
||||
|
||||
- name: Cache Node dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
~/.npm
|
||||
key: ${{ runner.os }}-node-deps-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-deps-
|
||||
|
||||
- name: Install dependencies (ubuntu only)
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
|
||||
@@ -94,7 +104,7 @@ jobs:
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
src-tauri/target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Config App
|
||||
env:
|
||||
@@ -108,23 +118,30 @@ jobs:
|
||||
|
||||
- name: Build for Ubuntu
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
timeout-minutes: 15
|
||||
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
|
||||
- name: Add Rust targets for macOS universal build
|
||||
if: matrix.os == 'macos-latest'
|
||||
run: |
|
||||
rustup target add aarch64-apple-darwin
|
||||
rustup target add x86_64-apple-darwin
|
||||
|
||||
- name: Build for macOS
|
||||
if: matrix.os == 'macos-latest'
|
||||
timeout-minutes: 20
|
||||
run: |
|
||||
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'
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
npm run tauri build -- --target x86_64-pc-windows-msvc
|
||||
New-Item -Path "output\windows" -ItemType Directory
|
||||
@@ -144,7 +161,7 @@ jobs:
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
src-tauri/target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Upload For Single Build
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -71,7 +71,7 @@ jobs:
|
||||
name_zh: ${{ matrix.name_zh }}
|
||||
url: ${{ matrix.url }}
|
||||
|
||||
# Publish Docker image
|
||||
# Publish Docker image (runs in parallel with app builds)
|
||||
publish-docker:
|
||||
if: |
|
||||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) ||
|
||||
|
||||
72
script/build_with_pake_cli.js
vendored
72
script/build_with_pake_cli.js
vendored
@@ -1,7 +1,7 @@
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import axios from "axios";
|
||||
import { execa } from "execa";
|
||||
// We'll call the CLI directly for icon handling
|
||||
|
||||
// Configuration logging
|
||||
const logConfiguration = () => {
|
||||
@@ -58,33 +58,7 @@ const buildParameters = () => {
|
||||
return params;
|
||||
};
|
||||
|
||||
// Icon download handling
|
||||
const downloadIcon = async (iconFile) => {
|
||||
try {
|
||||
const response = await axios.get(process.env.ICON, {
|
||||
responseType: "arraybuffer",
|
||||
});
|
||||
fs.writeFileSync(iconFile, response.data);
|
||||
return ["--icon", iconFile];
|
||||
} catch (error) {
|
||||
console.error("Error occurred during icon download:", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// Get icon file name based on platform
|
||||
const getIconFileName = () => {
|
||||
switch (process.platform) {
|
||||
case "linux":
|
||||
return "icon.png";
|
||||
case "darwin":
|
||||
return "icon.icns";
|
||||
case "win32":
|
||||
return "icon.ico";
|
||||
default:
|
||||
throw new Error("Unable to detect your OS system");
|
||||
}
|
||||
};
|
||||
// Icon will be handled directly by CLI
|
||||
|
||||
// Main execution
|
||||
const main = async () => {
|
||||
@@ -97,24 +71,16 @@ const main = async () => {
|
||||
let params = buildParameters();
|
||||
|
||||
// Multi-arch target is now handled in GitHub Actions workflow
|
||||
|
||||
// Download icon in parallel with parameter preparation if needed
|
||||
let iconPromise = null;
|
||||
|
||||
// Add icon parameter if provided - CLI will handle download and conversion
|
||||
if (process.env.ICON && process.env.ICON !== "") {
|
||||
const iconFile = getIconFileName();
|
||||
iconPromise = downloadIcon(iconFile);
|
||||
params.push("--icon", process.env.ICON);
|
||||
} else {
|
||||
console.log(
|
||||
"Won't download the icon as ICON environment variable is not defined!",
|
||||
"Won't use icon as ICON environment variable is not defined!",
|
||||
);
|
||||
}
|
||||
|
||||
// If icon is being downloaded, wait for it and add to params
|
||||
if (iconPromise) {
|
||||
const iconParams = await iconPromise;
|
||||
params.push(...iconParams);
|
||||
}
|
||||
|
||||
console.log("Pake parameters:", params.join(" "));
|
||||
console.log("Compiling....");
|
||||
|
||||
@@ -129,19 +95,25 @@ const main = async () => {
|
||||
// Move built files to output directory more efficiently
|
||||
const buildPaths = [
|
||||
`src-tauri/target/release/bundle`,
|
||||
`src-tauri/target/universal-apple-darwin/release/bundle`
|
||||
`src-tauri/target/universal-apple-darwin/release/bundle`,
|
||||
];
|
||||
|
||||
|
||||
for (const buildPath of buildPaths) {
|
||||
if (fs.existsSync(buildPath)) {
|
||||
const bundleFiles = fs.readdirSync(buildPath, { recursive: true })
|
||||
.filter(file => {
|
||||
const bundleFiles = fs
|
||||
.readdirSync(buildPath, { recursive: true })
|
||||
.filter((file) => {
|
||||
const fullPath = path.join(buildPath, file);
|
||||
return fs.statSync(fullPath).isFile() &&
|
||||
(file.endsWith('.dmg') || file.endsWith('.exe') ||
|
||||
file.endsWith('.deb') || file.endsWith('.rpm') || file.endsWith('.AppImage'));
|
||||
return (
|
||||
fs.statSync(fullPath).isFile() &&
|
||||
(file.endsWith(".dmg") ||
|
||||
file.endsWith(".exe") ||
|
||||
file.endsWith(".deb") ||
|
||||
file.endsWith(".rpm") ||
|
||||
file.endsWith(".AppImage"))
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
for (const file of bundleFiles) {
|
||||
const srcPath = path.join(buildPath, file);
|
||||
const destPath = path.join("output", path.basename(file));
|
||||
@@ -150,7 +122,7 @@ const main = async () => {
|
||||
break; // Found files, no need to check other paths
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Fallback to original method if no bundle files found
|
||||
const files = fs.readdirSync(".");
|
||||
const namePattern = new RegExp(`^${process.env.NAME}\\..*$`);
|
||||
@@ -161,7 +133,7 @@ const main = async () => {
|
||||
foundFiles = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!foundFiles) {
|
||||
console.log("Warning: No output files found matching pattern");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user