4 Commits

Author SHA1 Message Date
56106622b2 Fix Version Number
All checks were successful
Build and Push Image / build-and-push (push) Successful in 7m34s
2025-07-05 21:48:14 -04:00
21c11446d7 Added forward version number to wasm
All checks were successful
Build and Push Image / build-and-push (push) Successful in 6m36s
2025-07-05 21:42:46 -04:00
0093128001 Added forward version number to wasm 2025-07-05 21:42:31 -04:00
4d80c71f92 Added version number
All checks were successful
Build and Push Image / build-and-push (push) Successful in 7m31s
2025-07-05 21:09:01 -04:00
9 changed files with 2508 additions and 2463 deletions

View File

@@ -34,3 +34,4 @@ jobs:
context: .
push: true
tags: git.kaisei.app/amatsugu/aoba:${{ env.VERSION }}
build-args: VERSION=${{ env.VERSION }}

1
AobaClient/.env Normal file
View File

@@ -0,0 +1 @@
APP_VERSION=Debug

7
AobaClient/Cargo.lock generated
View File

@@ -37,6 +37,7 @@ name = "aoba-client"
version = "0.1.0"
dependencies = [
"dioxus",
"dotenv",
"prost",
"serde",
"serde_repr",
@@ -673,6 +674,12 @@ dependencies = [
"syn",
]
[[package]]
name = "dotenv"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]]
name = "dunce"
version = "1.0.5"

View File

@@ -19,6 +19,7 @@ web-sys = { version = "0.3.77", features = ["Storage", "Window"] }
[build-dependencies]
tonic-build = { version = "*", default-features = false, features = ["prost"] }
dotenv = "0.15.0"
[features]
default = ["web"]

View File

@@ -1,3 +1,8 @@
use dotenv::dotenv;
use std::env;
use std::fs::File;
use std::io::Write;
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure()
.build_server(false)
@@ -6,6 +11,26 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
&["../AobaServer/Proto/Aoba.proto", "../AobaServer/Proto/Auth.proto"],
&["../AobaServer/Proto/"],
)?;
forward_env();
Ok(())
}
fn forward_env() {
let dest_path = "./src/env.rs";
let mut f = File::create(&dest_path).unwrap();
f.write_all(b"// This file is automatically generated by build.rs\n\n")
.unwrap();
dotenv().ok();
for (key, value) in env::vars() {
if key.starts_with("APP_") {
f.write_all("#[allow(dead_code)]\n".as_bytes()).unwrap();
let line = format!(
"pub const {}: &'static str = \"{}\";\n",
key,
value.replace("\"", "\\\"")
);
f.write_all(line.as_bytes()).unwrap();
}
}
}

View File

@@ -1,6 +1,8 @@
use std::env;
use dioxus::prelude::*;
use crate::{Route, contexts::AuthContext};
use crate::{Route, contexts::AuthContext, env::APP_VERSION};
const NAV_CSS: Asset = asset!("/assets/style/nav.scss");
const NAV_ICON: Asset = asset!("/assets/favicon.ico");
@@ -47,9 +49,10 @@ pub fn Widgets() -> Element {
#[component]
pub fn Utils() -> Element {
let mut auth_context = use_context::<AuthContext>();
let version = APP_VERSION;
rsx! {
div { class: "utils",
div { "{version}" }
div { onclick: move |_| auth_context.logout(), "Logout" }
}
}

4
AobaClient/src/env.rs Normal file
View File

@@ -0,0 +1,4 @@
// This file is automatically generated by build.rs
#[allow(dead_code)]
pub const APP_VERSION: &'static str = "Debug";

View File

@@ -1,5 +1,6 @@
pub mod components;
pub mod contexts;
mod env;
mod layouts;
pub mod models;
pub mod route;

View File

@@ -24,7 +24,8 @@ RUN apt install -y protobuf-compiler libprotobuf-dev ffmpeg
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
RUN cargo binstall dioxus-cli --root /.cargo -y --force
ENV PATH="/.cargo/bin:$PATH"
ARG VERSION
ENV APP_VERSION=$VERSION
# Create the final bundle folder. Bundle always executes in release mode with optimizations enabled
RUN dx bundle --platform web
@@ -56,7 +57,8 @@ RUN dotnet publish "./AobaServer.csproj" -c $BUILD_CONFIGURATION -o /app/publish
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=client-builder /bin/ffmpeg /bin/ffprobe /bin/ffplay /usr/bin/
ENV APP_VERSION=$VERSION
ENTRYPOINT ["dotnet", "AobaServer.dll"]