diff --git a/Cargo.lock b/Cargo.lock index 05168cc72f1a67076e65474fabb6ca33b0e1f43d..6f366a9798560e57558cb38cd231bf450f79ddf2 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 9073c2378b33cb604d58516d4bd6560b1bc4ce74..cbde4f2de7cd4739d9504d38c89246f02d4600bc 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 <paulmakles@gmail.com>"] edition = "2018" diff --git a/publish.sh b/publish.sh index 18bab40db968a02d19335f4453892e208b7f9714..227d0fa40f09b6be313edaf03c39db6344f33068 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 0000000000000000000000000000000000000000..be25d6d9bdb54e54b29c9ca7ddc5e4438a167896 --- /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 48acd2bf746dd91e41c2a27fa36cc838be78ca4f..386e5316d989406f99b607bf8c960ade140d66f3 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 c25862cb949b01986348eb34c7c1acac6b9f6520..9ca42d67cb81da6dc958b35a8f88d80be7da28e7 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 0000000000000000000000000000000000000000..008c120b1a32883165c1ed0e5c3f08e2736259a1 --- /dev/null +++ b/src/version.rs @@ -0,0 +1 @@ +pub const VERSION: &str = "0.4.1-alpha.6";