Add Windows exe icon, clean release filenames, fix Linux build

- Embed microphone icon in Windows exe via winresource
- Rename release artifacts to friendly names (linux-x86_64, windows-x86_64)
- Fix warn macro import for Linux build
- Add cargo PATH to release script
- Fix tea CLI asset upload syntax

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-10 22:14:07 +01:00
parent 3865183a3f
commit 9522841346
7 changed files with 69 additions and 8 deletions
Generated
+45 -4
View File
@@ -2224,7 +2224,7 @@ dependencies = [
[[package]]
name = "mouth"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"anyhow",
"arboard",
@@ -2252,6 +2252,7 @@ dependencies = [
"tray-icon",
"windows-sys 0.59.0",
"winit",
"winresource",
]
[[package]]
@@ -3635,6 +3636,15 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_spanned"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26"
dependencies = [
"serde_core",
]
[[package]]
name = "serde_urlencoded"
version = "0.7.1"
@@ -3962,7 +3972,7 @@ dependencies = [
"cfg-expr",
"heck 0.5.0",
"pkg-config",
"toml",
"toml 0.8.2",
"version-compare",
]
@@ -4179,11 +4189,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d"
dependencies = [
"serde",
"serde_spanned",
"serde_spanned 0.6.9",
"toml_datetime 0.6.3",
"toml_edit 0.20.2",
]
[[package]]
name = "toml"
version = "1.1.2+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee"
dependencies = [
"indexmap",
"serde_core",
"serde_spanned 1.1.1",
"toml_datetime 1.1.1+spec-1.1.0",
"toml_parser",
"toml_writer",
"winnow 1.0.1",
]
[[package]]
name = "toml_datetime"
version = "0.6.3"
@@ -4221,7 +4246,7 @@ checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"serde_spanned 0.6.9",
"toml_datetime 0.6.3",
"winnow 0.5.40",
]
@@ -4247,6 +4272,12 @@ dependencies = [
"winnow 1.0.1",
]
[[package]]
name = "toml_writer"
version = "1.1.1+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db"
[[package]]
name = "tower"
version = "0.5.3"
@@ -5303,6 +5334,16 @@ dependencies = [
"memchr",
]
[[package]]
name = "winresource"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087"
dependencies = [
"toml 1.1.2+spec-1.1.0",
"version_check",
]
[[package]]
name = "wit-bindgen"
version = "0.51.0"
+3
View File
@@ -67,5 +67,8 @@ serde_json = "1"
anyhow = "1"
thiserror = "2"
[build-dependencies]
winresource = "0.1"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.59", features = ["Win32_System_Console", "Win32_UI_WindowsAndMessaging", "Win32_System_Pipes", "Win32_System_IO", "Win32_Storage_FileSystem", "Win32_Foundation", "Win32_Security"] }
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

+1
View File
@@ -0,0 +1 @@
1 ICON "assets/mouth.ico"
Executable
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
set -e
~/.cargo/bin/cargo xwin build --release --target x86_64-pc-windows-msvc
cp target/x86_64-pc-windows-msvc/release/mouth.exe /mnt/nas/xfer/mouth/
echo "Done: /mnt/nas/xfer/mouth/mouth.exe"
+10
View File
@@ -0,0 +1,10 @@
fn main() {
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
if target_os == "windows" {
let mut res = winresource::WindowsResource::new();
res.set_icon("assets/mouth.ico");
if let Err(e) = res.compile() {
eprintln!("cargo:warning=Failed to embed Windows icon: {e}");
}
}
}
+5 -4
View File
@@ -55,14 +55,15 @@ FAILED=()
build_target() {
local target="$1"
local label="$2"
local ext="${3:-}"
local friendly_name="$3"
local ext="${4:-}"
echo "--- Building ${label} (${target}) ---"
if cargo build --release --target "${target}" 2>&1; then
local binary="target/${target}/release/${BINARY_NAME}${ext}"
if [ -f "${binary}" ]; then
local archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-${target}"
local archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-${friendly_name}"
if [ -n "${ext}" ]; then
# Windows: ship the exe directly
cp "${binary}" "${archive}${ext}"
@@ -91,7 +92,7 @@ build_target() {
# ============================================================
# Linux x86_64 (native — always available)
build_target "x86_64-unknown-linux-gnu" "Linux x86_64"
build_target "x86_64-unknown-linux-gnu" "Linux x86_64" "linux-x86_64"
# Windows x86_64 (MSVC target via cargo-xwin)
if command -v cargo-xwin &>/dev/null && rustup target list --installed | grep -q x86_64-pc-windows-msvc; then
@@ -99,7 +100,7 @@ if command -v cargo-xwin &>/dev/null && rustup target list --installed | grep -q
if cargo xwin build --release --target x86_64-pc-windows-msvc 2>&1; then
local_binary="target/x86_64-pc-windows-msvc/release/${BINARY_NAME}.exe"
if [ -f "${local_binary}" ]; then
archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-x86_64-pc-windows-msvc.exe"
archive="${RELEASE_DIR}/${BINARY_NAME}-${TAG}-windows-x86_64.exe"
cp "${local_binary}" "${archive}"
echo " -> ${archive}"
BUILT+=("${archive}")