Skip to content

Commit f4a0d1d

Browse files
committed
Use default Cargo layout in CI
1 parent 5fca50c commit f4a0d1d

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

scripts/tauri-build.js

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { applyMacTauriEnv } = require('../platform/macos/node/tauriEnv');
99
const { resolveWindowsTauriArgs } = require('../platform/windows/node/vsDevCmd');
1010

1111
const isMac = process.platform === 'darwin';
12+
const isGitHubActions = String(process.env.GITHUB_ACTIONS || '').toLowerCase() === 'true';
1213
const env = { ...process.env };
1314
const pathKey = pathKeyForEnv(env);
1415
const forwardedArgs = process.argv.slice(2);
@@ -29,31 +30,33 @@ if (isMac) {
2930
applyMacTauriEnv(env, { logPrefix: 'tauri-build' });
3031
}
3132

32-
// Keep common build artifacts on the workspace volume when possible.
33-
// This avoids filling the system disk during Rust/Cargo compilation.
34-
try {
35-
const repoRoot = path.resolve(__dirname, '..');
36-
const tmpDir = path.resolve(repoRoot, 'build-temp', 'shotstyle-tmp');
37-
const cargoTargetDir = (() => {
38-
const override = String(env.SHOTSTYLE_CARGO_TARGET_DIR || '').trim();
39-
if (override) return path.resolve(override);
40-
const useApfsTarget = String(env.SHOTSTYLE_USE_APFS_CARGO || '').trim() === '1';
41-
if (useApfsTarget) {
42-
const apfsTarget = ensureMacCargoTargetOnApfs({ repoRoot, logPrefix: 'tauri-build' });
43-
if (apfsTarget) return apfsTarget;
44-
}
45-
return path.resolve(repoRoot, 'build-temp', 'cargo-target');
46-
})();
33+
// Keep common build artifacts on the workspace volume when possible for local builds.
34+
// CI release jobs should use Tauri's default target layout so the action can locate bundles.
35+
if (!isGitHubActions) {
36+
try {
37+
const repoRoot = path.resolve(__dirname, '..');
38+
const tmpDir = path.resolve(repoRoot, 'build-temp', 'shotstyle-tmp');
39+
const cargoTargetDir = (() => {
40+
const override = String(env.SHOTSTYLE_CARGO_TARGET_DIR || '').trim();
41+
if (override) return path.resolve(override);
42+
const useApfsTarget = String(env.SHOTSTYLE_USE_APFS_CARGO || '').trim() === '1';
43+
if (useApfsTarget) {
44+
const apfsTarget = ensureMacCargoTargetOnApfs({ repoRoot, logPrefix: 'tauri-build' });
45+
if (apfsTarget) return apfsTarget;
46+
}
47+
return path.resolve(repoRoot, 'build-temp', 'cargo-target');
48+
})();
4749

48-
fs.mkdirSync(tmpDir, { recursive: true });
49-
fs.mkdirSync(cargoTargetDir, { recursive: true });
50+
fs.mkdirSync(tmpDir, { recursive: true });
51+
fs.mkdirSync(cargoTargetDir, { recursive: true });
5052

51-
env.TMPDIR = env.TMPDIR || tmpDir;
52-
env.CARGO_TARGET_DIR = env.CARGO_TARGET_DIR || cargoTargetDir;
53+
env.TMPDIR = env.TMPDIR || tmpDir;
54+
env.CARGO_TARGET_DIR = env.CARGO_TARGET_DIR || cargoTargetDir;
5355

54-
console.log(`[tauri-build] TMPDIR=${env.TMPDIR}`);
55-
console.log(`[tauri-build] CARGO_TARGET_DIR=${env.CARGO_TARGET_DIR}`);
56-
} catch {}
56+
console.log(`[tauri-build] TMPDIR=${env.TMPDIR}`);
57+
console.log(`[tauri-build] CARGO_TARGET_DIR=${env.CARGO_TARGET_DIR}`);
58+
} catch {}
59+
}
5760

5861
// Work around macOS AppleDouble sidecar files on non-APFS volumes (exFAT/SMB).
5962
const appleDoubleScrubber = (() => {

0 commit comments

Comments
 (0)