automatically create gitbutler-ui/build

This commit is contained in:
Josh Junon 2024-03-01 13:00:31 +01:00
parent 612645cfd1
commit 73faf32b29
2 changed files with 20 additions and 4 deletions

View File

@ -10,10 +10,6 @@ runs:
prefix-key: gitbutler-client
shared-key: rust
- name: Placeholder for ui assets
shell: bash
run: mkdir gitbutler-ui/build
- name: Check versions
shell: bash
run: |

View File

@ -1,3 +1,23 @@
fn main() {
// Make the UI build directory if it doesn't already exist.
// We do this here because the tauri context macro expects it to
// exist at build time, and it's otherwise manually required to create
// it before building.
let manifest_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
assert_eq!(manifest_dir.file_name().unwrap(), "gitbutler-app");
let build_dir = manifest_dir.parent().unwrap().join("gitbutler-ui/build");
if !build_dir.exists() {
// NOTE(qix-): Do not use `create_dir_all` here - the parent directory
// NOTE(qix-): already exists, and we want to fail if not (for some reason).
#[allow(clippy::expect_fun_call, clippy::create_dir)]
std::fs::create_dir(&build_dir).expect(
format!(
"failed to create gitbutler-ui build directory: {:?}",
build_dir
)
.as_str(),
);
}
tauri_build::build();
}