Skip to content

Commit facdfb5

Browse files
committed
🎨 update pake cli actions
1 parent fe85dff commit facdfb5

File tree

3 files changed

+69
-14
lines changed

3 files changed

+69
-14
lines changed

.github/workflows/pake-cli.yaml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
uses: actions/setup-node@v4
6969
with:
7070
node-version: 22
71+
cache: 'npm'
7172

7273
- name: Install Rust for ubuntu-24.04
7374
if: inputs.platform == 'ubuntu-24.04'
@@ -102,11 +103,32 @@ jobs:
102103
packages: libsoup-3.0-dev libdbus-1-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
103104
version: 1.1
104105

105-
- name: Install pake-cli local
106-
shell: bash
106+
- name: Cache Node dependencies
107+
uses: actions/cache@v4
108+
with:
109+
path: |
110+
node_modules
111+
~/.npm
112+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
113+
restore-keys: |
114+
${{ runner.os }}-node-
115+
116+
- name: Cache pake-cli installation
117+
uses: actions/cache@v4
118+
id: pake_cache
119+
with:
120+
path: node_modules/pake-cli
121+
key: ${{ runner.os }}-pake-cli-${{ hashFiles('**/package.json') }}
122+
123+
- name: Install pake-cli and script dependencies
107124
run: |
108-
echo "install pake on local"
109-
npm install pake-cli
125+
if [ ! -d "node_modules/pake-cli" ]; then
126+
echo "Installing pake-cli..."
127+
npm install pake-cli
128+
else
129+
echo "pake-cli found in cache"
130+
fi
131+
npm install execa axios --no-package-lock
110132
111133
- name: Rust cache restore
112134
uses: actions/cache/[email protected]
@@ -120,11 +142,6 @@ jobs:
120142
node_modules/pake-cli/src-tauri/target/
121143
key: ${{ inputs.platform }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
122144

123-
- name: Install dependencies
124-
run: |
125-
npm install execa
126-
npm install axios
127-
128145
- name: Build with pake-cli
129146
timeout-minutes: 15
130147
run: |

bin/builders/BaseBuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default abstract class BaseBuilder {
3636
}
3737

3838
private getBuildTimeout(): number {
39-
return 300000; // 5 minutes for build process
39+
return 900000; // 15 minutes for all builds
4040
}
4141

4242
async prepare() {

script/build_with_pake_cli.js

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,24 @@ const main = async () => {
9797
let params = buildParameters();
9898

9999
// Multi-arch target is now handled in GitHub Actions workflow
100-
100+
101+
// Download icon in parallel with parameter preparation if needed
102+
let iconPromise = null;
101103
if (process.env.ICON && process.env.ICON !== "") {
102104
const iconFile = getIconFileName();
103-
const iconParams = await downloadIcon(iconFile);
104-
params.push(...iconParams);
105+
iconPromise = downloadIcon(iconFile);
105106
} else {
106107
console.log(
107108
"Won't download the icon as ICON environment variable is not defined!",
108109
);
109110
}
110111

112+
// If icon is being downloaded, wait for it and add to params
113+
if (iconPromise) {
114+
const iconParams = await iconPromise;
115+
params.push(...iconParams);
116+
}
117+
111118
console.log("Pake parameters:", params.join(" "));
112119
console.log("Compiling....");
113120

@@ -119,14 +126,45 @@ const main = async () => {
119126
fs.mkdirSync("output");
120127
}
121128

122-
// Move built files to output directory
129+
// Move built files to output directory more efficiently
130+
const buildPaths = [
131+
`src-tauri/target/release/bundle`,
132+
`src-tauri/target/universal-apple-darwin/release/bundle`
133+
];
134+
135+
for (const buildPath of buildPaths) {
136+
if (fs.existsSync(buildPath)) {
137+
const bundleFiles = fs.readdirSync(buildPath, { recursive: true })
138+
.filter(file => {
139+
const fullPath = path.join(buildPath, file);
140+
return fs.statSync(fullPath).isFile() &&
141+
(file.endsWith('.dmg') || file.endsWith('.exe') ||
142+
file.endsWith('.deb') || file.endsWith('.rpm') || file.endsWith('.AppImage'));
143+
});
144+
145+
for (const file of bundleFiles) {
146+
const srcPath = path.join(buildPath, file);
147+
const destPath = path.join("output", path.basename(file));
148+
await execa("cp", [srcPath, destPath]);
149+
}
150+
break; // Found files, no need to check other paths
151+
}
152+
}
153+
154+
// Fallback to original method if no bundle files found
123155
const files = fs.readdirSync(".");
124156
const namePattern = new RegExp(`^${process.env.NAME}\\..*$`);
157+
let foundFiles = false;
125158
for (const file of files) {
126159
if (namePattern.test(file)) {
127160
await execa("mv", [file, path.join("output", file)]);
161+
foundFiles = true;
128162
}
129163
}
164+
165+
if (!foundFiles) {
166+
console.log("Warning: No output files found matching pattern");
167+
}
130168

131169
console.log("Build Success");
132170
process.chdir("../..");

0 commit comments

Comments
 (0)