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]]
name = "revolt"
version = "0.4.1-alpha.3"
version = "0.0.0"
dependencies = [
"async-std",
"async-tungstenite",

View File

@@ -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"

View File

@@ -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}

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 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;

View File

@@ -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": {

1
src/version.rs Normal file
View File

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