From fee1b494ff5706ba56c153a48152adff05617eb3 Mon Sep 17 00:00:00 2001 From: Thilo Billerbeck Date: Tue, 19 Nov 2024 02:54:11 +0100 Subject: [PATCH] fix: add version tag to footer --- Dockerfile | 1 + index.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5ee44e1..60c17bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ RUN corepack enable COPY . /app WORKDIR /app RUN git rev-parse --short HEAD > .git-rev +RUN git describe --tags --abbrev=0 > .git-tag RUN rm -rf .git FROM base AS prod-deps diff --git a/index.ts b/index.ts index feb306d..9ca2a74 100644 --- a/index.ts +++ b/index.ts @@ -44,8 +44,9 @@ if (process.env.SENTRY_DSN) { let version = "development" const gitRevPath = pathJoin(__dirname, '.git-rev') -if (require('fs').existsSync(gitRevPath)) { - version = readFileSync(gitRevPath, 'utf-8').trim() +const gitTagPath = pathJoin(__dirname, '.git-tag') +if (require('fs').existsSync(gitRevPath) && require('fs').existsSync(gitTagPath)) { + version = `${readFileSync(gitTagPath, 'utf-8').toString().trim()} (${readFileSync(gitRevPath, 'utf-8').toString().trim()})` } app.register(fastifyCookie)