diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6e1d135..267e30c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -65,6 +65,8 @@ jobs: context: . platforms: ${{ matrix.platform }} labels: ${{ steps.meta.outputs.labels }} + build-args: | + HAPPYVIEW_VERSION=${{ github.event.release.tag_name }} cache-from: type=gha,scope=build-${{ matrix.platform }} cache-to: type=gha,scope=build-${{ matrix.platform }},mode=max,ignore-error=true outputs: type=image,"name=${{ env.GHCR_IMAGE }},${{ env.ATCR_IMAGE }}",push-by-digest=true,name-canonical=true,push=true diff --git a/Dockerfile b/Dockerfile index 5db33a5..96d2f5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,8 @@ RUN cargo build --release && rm -rf src target/release/.fingerprint/happyview-* # Build application code COPY src/ src/ COPY migrations/ migrations/ +ARG HAPPYVIEW_VERSION +ENV HAPPYVIEW_VERSION=$HAPPYVIEW_VERSION RUN cargo build --release FROM debian:bookworm-slim diff --git a/src/server.rs b/src/server.rs index 61459a8..0757475 100644 --- a/src/server.rs +++ b/src/server.rs @@ -120,9 +120,14 @@ async fn config_endpoint(State(state): State) -> Json v.trim_start_matches('v'), + _ => env!("CARGO_PKG_VERSION"), + }; + Json(serde_json::json!({ "public_url": state.config.public_url, - "version": env!("CARGO_PKG_VERSION"), + "version": version, "database_backend": format!("{:?}", state.config.database_backend).to_lowercase(), "jetstream_url": state.config.jetstream_url, "relay_url": state.config.relay_url,