Skip to content

Commit 70aef7c

Browse files
committed
ci(nightly): fix bundling
1 parent 611e120 commit 70aef7c

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

src/build.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,36 @@ fn main() {
1414
out.push_str(&format!("{:x} {}\n", hash, path));
1515
});
1616

17-
let sums_path = PathBuf::from("./gen/SHA256SUMS");
17+
let target_dir = target_dir();
18+
let sums_path = target_dir.join("SHA256SUMS");
1819
std::fs::write(&sums_path, out).unwrap();
1920

2021
if !cfg!(debug_assertions) {
2122
sign_sha256sums(&sums_path);
2223
} else {
23-
std::fs::write("./gen/SHA256SUMS.sig", "NOT SIGNED NEEDED FOR DEBUG").unwrap();
24+
std::fs::write(
25+
sums_path.with_extension(".sig"),
26+
"NOT SIGNED NEEDED FOR DEBUG",
27+
)
28+
.unwrap();
2429
}
2530

2631
tauri_build::build();
2732
}
2833

34+
fn target_dir() -> PathBuf {
35+
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
36+
// see <https://github.com/rust-lang/cargo/issues/5457>
37+
out_dir
38+
.parent()
39+
.unwrap()
40+
.parent()
41+
.unwrap()
42+
.parent()
43+
.unwrap()
44+
.to_path_buf()
45+
}
46+
2947
fn read_folder_recursive<F>(path: PathBuf, cb: &mut F)
3048
where
3149
F: FnMut(PathBuf),
@@ -48,21 +66,15 @@ fn sign_sha256sums(path: &PathBuf) {
4866

4967
let key_base64 =
5068
std::env::var("TAURI_SIGNING_PRIVATE_KEY").expect("TAURI_SIGNING_PRIVATE_KEY missing");
51-
5269
let password = std::env::var("TAURI_SIGNING_PRIVATE_KEY_PASSWORD")
5370
.expect("TAURI_SIGNING_PRIVATE_KEY_PASSWORD missing");
5471

55-
// Decode the private key from base64 (following Tauri's pattern)
5672
let key_bytes = base64::engine::general_purpose::STANDARD
5773
.decode(&key_base64)
5874
.expect("Failed to decode base64 secret key");
59-
6075
let key_str = String::from_utf8(key_bytes).expect("Secret key is not valid UTF-8");
6176

62-
// Load the secret key box from the string representation
6377
let sk_box = SecretKeyBox::from_string(&key_str).expect("Invalid secret key format");
64-
65-
// Decrypt the secret key using the password
6678
let secret_key = sk_box
6779
.into_secret_key(Some(password))
6880
.expect("Failed to decrypt secret key - invalid password");
@@ -76,11 +88,8 @@ fn sign_sha256sums(path: &PathBuf) {
7688
minisign::sign(None, &secret_key, data_reader, None, None).expect("Failed to sign data");
7789

7890
// Write the signature to a .sig file
79-
let mut sig_path = path.clone();
80-
sig_path.set_extension("sig");
81-
91+
let sig_path = path.with_extension("sig");
8292
let mut file = std::fs::File::create(&sig_path).expect("Failed to create signature file");
83-
8493
file.write_all(signature_box.to_string().as_bytes())
8594
.expect("Failed to write signature");
8695

src/tauri.conf.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
"licenseFile": "../LICENSE",
4242
"homepage": "https://github.com/eythaann/Seelen-UI",
4343
"resources": {
44-
"static": "static",
45-
"gen/SHA256SUMS": "SHA256SUMS",
46-
"gen/SHA256SUMS.sig": "SHA256SUMS.sig"
44+
"static": "static"
4745
},
4846
"targets": [
4947
"nsis"
@@ -67,17 +65,17 @@
6765
"bulgarian",
6866
"dutch",
6967
"english",
68+
"french",
7069
"german",
7170
"japanese",
7271
"korean",
7372
"portuguesebr",
7473
"russian",
75-
"tradchinese",
7674
"simpchinese",
77-
"french",
7875
"spanish",
79-
"turkish",
80-
"swedish"
76+
"swedish",
77+
"tradchinese",
78+
"turkish"
8179
]
8280
}
8381
},

src/templates/installer-hooks.nsh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
${EndIf}
1717

1818
File /a "${__FILEDIR__}\..\..\sluhk.dll"
19+
File /a "${__FILEDIR__}\..\..\SHA256SUMS"
20+
File /a "${__FILEDIR__}\..\..\SHA256SUMS.sig"
1921

2022
; Include PDB file only for nightly builds
2123
${StrLoc} $0 "${VERSION}" "nightly" ">"

0 commit comments

Comments
 (0)