Move versioning to source.

This commit is contained in:
Paul
2021-05-03 15:03:30 +01:00
parent fa960ebc94
commit c086fe7ac4
7 changed files with 14 additions and 8 deletions

2
Cargo.lock generated
View File

@@ -2475,7 +2475,7 @@ dependencies = [
[[package]] [[package]]
name = "revolt" name = "revolt"
version = "0.4.1-alpha.3" version = "0.0.0"
dependencies = [ dependencies = [
"async-std", "async-std",
"async-tungstenite", "async-tungstenite",

View File

@@ -1,6 +1,9 @@
[package] [package]
name = "revolt" 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>"] authors = ["Paul Makles <paulmakles@gmail.com>"]
edition = "2018" edition = "2018"

View File

@@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# Tip: for subsequent builds, don't update Cargo.toml source set_version.sh
# in order to not download all the crates again.
# Update Cargo.toml on major release.
version=0.4.1-alpha.4-patch.0
docker build -t revoltchat/server:${version} . && docker build -t revoltchat/server:${version} . &&
docker push revoltchat/server:${version} docker push revoltchat/server:${version}

3
set_version.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
export version=0.4.1-alpha.6
echo "pub const VERSION: String = \"${version}\";" > src/version.rs

View File

@@ -15,6 +15,7 @@ extern crate ctrlc;
pub mod database; pub mod database;
pub mod notifications; pub mod notifications;
pub mod version;
pub mod routes; pub mod routes;
pub mod util; pub mod util;
@@ -39,7 +40,7 @@ async fn main() {
dotenv::dotenv().ok(); dotenv::dotenv().ok();
env_logger::init_from_env(env_logger::Env::default().filter_or("RUST_LOG", "info")); 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(); util::variables::preflight_checks();
database::connect().await; database::connect().await;

View File

@@ -9,7 +9,7 @@ use rocket_contrib::json::JsonValue;
#[get("/")] #[get("/")]
pub async fn root() -> JsonValue { pub async fn root() -> JsonValue {
json!({ json!({
"revolt": "0.4.1-alpha.4", "revolt": crate::version::VERSION,
"features": { "features": {
"registration": !*DISABLE_REGISTRATION, "registration": !*DISABLE_REGISTRATION,
"captcha": { "captcha": {

1
src/version.rs Normal file
View File

@@ -0,0 +1 @@
pub const VERSION: &str = "0.4.1-alpha.6";