diff --git a/.github/workflows/ci-docker-publish.yml b/.github/workflows/ci-docker-publish.yml index dc2eb8510..99ae89021 100644 --- a/.github/workflows/ci-docker-publish.yml +++ b/.github/workflows/ci-docker-publish.yml @@ -64,3 +64,5 @@ jobs: ${{ env.REGISTRY }}/blockworks-foundation/${{ env.IMAGE }}:latest cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + "GITHUB_SHA=${{ github.sha }}" diff --git a/Dockerfile b/Dockerfile index eeebb96ba..75f572c17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,8 @@ COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM base as build +ARG GITHUB_SHA +ENV GITHUB_SHA ${GITHUB_SHA} COPY --from=plan /app/recipe.json . RUN cargo chef cook --release --recipe-path recipe.json COPY . . diff --git a/lib/client/src/util.rs b/lib/client/src/util.rs index 45f68545a..b8e6cbb46 100644 --- a/lib/client/src/util.rs +++ b/lib/client/src/util.rs @@ -61,16 +61,23 @@ pub fn tracing_subscriber_init() { } pub fn print_git_version() { - info!( - "version is {}[{}{}]", - env!("VERGEN_GIT_SHA"), - env!("VERGEN_GIT_COMMIT_DATE"), - if env!("VERGEN_GIT_DIRTY") == "true" { - "-dirty" - } else { - "" + match option_env!("GITHUB_SHA") { + Some(sha) => { + info!("version is {}[github]", sha,); } - ); + None => { + info!( + "version is {}[{}{}]", + env!("VERGEN_GIT_SHA"), + env!("VERGEN_GIT_COMMIT_DATE"), + if env!("VERGEN_GIT_DIRTY") == "true" { + "-dirty" + } else { + "" + } + ); + } + } } pub async fn http_error_handling(