diff --git a/Cargo.lock b/Cargo.lock index 05168cc7..6f366a97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2475,7 +2475,7 @@ dependencies = [ [[package]] name = "revolt" -version = "0.4.1-alpha.3" +version = "0.0.0" dependencies = [ "async-std", "async-tungstenite", diff --git a/Cargo.toml b/Cargo.toml index 9073c237..cbde4f2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,9 @@ [package] name = "revolt" -version = "0.4.1-alpha.3" +# To help optimise CI and Docker builds. +# Version here is left as 0.0.0, please +# adjust and run ./set_version.sh instead. +version = "0.0.0" authors = ["Paul Makles "] edition = "2018" diff --git a/publish.sh b/publish.sh index 18bab40d..227d0fa4 100755 --- a/publish.sh +++ b/publish.sh @@ -1,7 +1,5 @@ #!/bin/bash -# Tip: for subsequent builds, don't update Cargo.toml -# in order to not download all the crates again. -# Update Cargo.toml on major release. -version=0.4.1-alpha.4-patch.0 +source set_version.sh + docker build -t revoltchat/server:${version} . && docker push revoltchat/server:${version} diff --git a/set_version.sh b/set_version.sh new file mode 100755 index 00000000..be25d6d9 --- /dev/null +++ b/set_version.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export version=0.4.1-alpha.6 +echo "pub const VERSION: String = \"${version}\";" > src/version.rs diff --git a/src/main.rs b/src/main.rs index 48acd2bf..386e5316 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,6 +15,7 @@ extern crate ctrlc; pub mod database; pub mod notifications; +pub mod version; pub mod routes; pub mod util; @@ -39,7 +40,7 @@ async fn main() { dotenv::dotenv().ok(); env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "info")); - info!("Starting REVOLT server."); + info!("Starting REVOLT server [version {}].", crate::version::VERSION); util::variables::preflight_checks(); database::connect().await; diff --git a/src/routes/root.rs b/src/routes/root.rs index c25862cb..9ca42d67 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -9,7 +9,7 @@ use rocket_contrib::json::JsonValue; #[get("/")] pub async fn root() -> JsonValue { json!({ - "revolt": "0.4.1-alpha.4", + "revolt": crate::version::VERSION, "features": { "registration": !*DISABLE_REGISTRATION, "captcha": { diff --git a/src/version.rs b/src/version.rs new file mode 100644 index 00000000..008c120b --- /dev/null +++ b/src/version.rs @@ -0,0 +1 @@ +pub const VERSION: &str = "0.4.1-alpha.6";