2023-09-30 08:09:29 +01:00
|
|
|
use std::fs::File;
|
|
|
|
|
2023-09-30 10:15:32 +01:00
|
|
|
use action::{download::{download_release, install_lune}, fmt::LogFormatter};
|
2023-09-30 08:53:32 +01:00
|
|
|
use actions_core as core;
|
2023-09-30 08:50:03 +01:00
|
|
|
use tracing::Level;
|
|
|
|
use tracing_unwrap::ResultExt;
|
2023-09-30 08:09:29 +01:00
|
|
|
|
|
|
|
fn main() {
|
2023-09-30 08:50:03 +01:00
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
better_panic::install();
|
|
|
|
} else {
|
|
|
|
tracing_subscriber::fmt()
|
2023-09-30 08:53:32 +01:00
|
|
|
.with_max_level(match core::is_debug() {
|
|
|
|
true => Level::DEBUG,
|
2023-09-30 08:55:17 +01:00
|
|
|
false => Level::INFO,
|
2023-09-30 08:53:32 +01:00
|
|
|
})
|
2023-09-30 10:15:32 +01:00
|
|
|
.event_format(LogFormatter)
|
2023-09-30 08:50:03 +01:00
|
|
|
.init();
|
|
|
|
}
|
2023-09-30 08:09:29 +01:00
|
|
|
|
2023-09-30 08:50:03 +01:00
|
|
|
let (zip_path, meta) =
|
|
|
|
download_release().expect_or_log("failed to download latest lune release");
|
2023-09-30 08:09:29 +01:00
|
|
|
|
|
|
|
install_lune(
|
|
|
|
File::open(&zip_path).expect(
|
|
|
|
format!(
|
|
|
|
"failed to open downloaded lune release zip file @ {}",
|
|
|
|
zip_path.to_string_lossy().to_string()
|
|
|
|
)
|
|
|
|
.as_str(),
|
|
|
|
),
|
|
|
|
meta,
|
|
|
|
)
|
2023-09-30 08:50:03 +01:00
|
|
|
.expect_or_log(
|
|
|
|
"failed to install lune. did we not have perms to write to the required directories?",
|
|
|
|
);
|
2023-09-30 08:09:29 +01:00
|
|
|
}
|