From 9694e5d56f8d3a852f9ce6d96868113617155d4e Mon Sep 17 00:00:00 2001 From: tolik518 Date: Fri, 20 Feb 2026 19:49:58 +0100 Subject: [PATCH 1/3] added version to the executables --- factorion-bot-discord/src/main.rs | 7 +++++++ factorion-bot-reddit/src/main.rs | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/factorion-bot-discord/src/main.rs b/factorion-bot-discord/src/main.rs index 30c3c60..dcea3f1 100644 --- a/factorion-bot-discord/src/main.rs +++ b/factorion-bot-discord/src/main.rs @@ -50,7 +50,14 @@ fn init() { #[tokio::main] async fn main() -> Result<(), Box> { + let args = std::env::args().collect::>(); + if args.len() > 1 && (args[1] == "--version" || args[1] == "-v") { + println!("factorion-bot-discord v{}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } + init(); + let consts = Consts { float_precision: std::env::var("FLOAT_PRECISION") .map(|s| s.parse().unwrap()) diff --git a/factorion-bot-reddit/src/main.rs b/factorion-bot-reddit/src/main.rs index 3d2db8e..f3d8b5d 100644 --- a/factorion-bot-reddit/src/main.rs +++ b/factorion-bot-reddit/src/main.rs @@ -60,6 +60,12 @@ impl Default for SubredditMode { #[tokio::main] async fn main() -> Result<(), Box> { + let args = std::env::args().collect::>(); + if args.len() > 1 && (args[1] == "--version" || args[1] == "-v") { + println!("factorion-bot-reddit v{}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } + init(); let consts = Consts { From a79465139e2e73f1f5961c7f750393efe1812b69 Mon Sep 17 00:00:00 2001 From: tolik518 Date: Fri, 20 Feb 2026 19:50:32 +0100 Subject: [PATCH 2/3] added version to dockerfile --- .github/workflows/test_and_deploy.yml | 2 +- Dockerfile | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 4e2c2b5..0b955ea 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -112,7 +112,7 @@ jobs: cd $SSH_PATH && \ git fetch origin --tags && \ git checkout "refs/tags/$VERSION" && \ - docker build -t factorion-bot:"$VERSION" . && \ + docker build -t factorion-bot:"$VERSION" --build-arg VERSION="$VERSION" . && \ docker stop factorion-bot || true && \ sleep 3 && \ docker rm factorion-bot || true && \ diff --git a/Dockerfile b/Dockerfile index cf30570..1e8499e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,15 @@ COPY . . RUN cd factorion-bot-reddit && cargo install --path . FROM debian:bookworm-slim +ARG VERSION=latest + +LABEL org.opencontainers.image.version="${VERSION}" +LABEL org.opencontainers.image.title="factorion-bot" +LABEL org.opencontainers.image.description="A Reddit bot that calculates factorials" +LABEL org.opencontainers.image.url="https://github.com/tolik518/factorion-bot" +LABEL org.opencontainers.image.source="https://github.com/tolik518/factorion-bot" +LABEL org.opencontainers.image.licenses="MIT" + RUN apt-get update && apt install -y openssl ca-certificates curl WORKDIR /usr/factorion COPY --from=builder /usr/local/cargo/bin/factorion-bot-reddit /usr/bin/factorion-bot From e1b235ce0ec20ae12e9fbb54098f2cf06112347f Mon Sep 17 00:00:00 2001 From: tolik518 Date: Fri, 20 Feb 2026 19:52:01 +0100 Subject: [PATCH 3/3] bump version --- Cargo.lock | 4 ++-- factorion-bot-discord/Cargo.toml | 2 +- factorion-bot-reddit/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f5fc24e..8c42884 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -399,7 +399,7 @@ dependencies = [ [[package]] name = "factorion-bot-discord" -version = "2.1.11" +version = "2.1.12" dependencies = [ "anyhow", "dotenvy", @@ -414,7 +414,7 @@ dependencies = [ [[package]] name = "factorion-bot-reddit" -version = "5.2.11" +version = "5.2.12" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/factorion-bot-discord/Cargo.toml b/factorion-bot-discord/Cargo.toml index dda5e49..54c42d0 100644 --- a/factorion-bot-discord/Cargo.toml +++ b/factorion-bot-discord/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factorion-bot-discord" -version = "2.1.11" +version = "2.1.12" edition = "2024" description = "factorion-bot (for factorials and related) on Discord" license = "MIT" diff --git a/factorion-bot-reddit/Cargo.toml b/factorion-bot-reddit/Cargo.toml index a8a5e7c..2f97f90 100644 --- a/factorion-bot-reddit/Cargo.toml +++ b/factorion-bot-reddit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "factorion-bot-reddit" -version = "5.2.11" +version = "5.2.12" edition = "2024" description = "factorion-bot (for factorials and related) on Reddit" license = "MIT"