From 7f348fd0743259882f4e8dd013c1386f38d4e1fa Mon Sep 17 00:00:00 2001 From: Dessalines Date: Mon, 26 Apr 2021 09:57:41 -0400 Subject: [PATCH] Add UI version to UI via docker. Fixes #263 (#278) * Add UI version to UI via docker. Fixes #263 * Adding git fetch tags to CI. --- .drone.yml | 2 ++ Dockerfile | 4 ++++ src/shared/components/footer.tsx | 6 +++++- src/shared/components/main.tsx | 4 +++- src/shared/components/navbar.tsx | 5 ++++- src/shared/version.ts | 1 + 6 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/shared/version.ts diff --git a/.drone.yml b/.drone.yml index 7c4cea8a..bfb6ab7a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,6 +14,7 @@ steps: - apk add git - git submodule init - git submodule update --recursive --remote + - git fetch --tags - name: yarn image: node:14-alpine @@ -110,6 +111,7 @@ steps: - apk add git - git submodule init - git submodule update --recursive --remote + - git fetch --tags when: ref: - refs/heads/main diff --git a/Dockerfile b/Dockerfile index c03cdc6d..a56a391b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,10 @@ COPY generate_translations.js \ COPY lemmy-translations lemmy-translations COPY src src +COPY .git .git + +# Set UI version +RUN echo "export const VERSION = '$(git describe --tag)';" > "src/shared/version.ts" RUN yarn RUN yarn build:prod diff --git a/src/shared/components/footer.tsx b/src/shared/components/footer.tsx index 16f5fc76..f688bb62 100644 --- a/src/shared/components/footer.tsx +++ b/src/shared/components/footer.tsx @@ -3,6 +3,7 @@ import { Link } from "inferno-router"; import { i18n } from "../i18next"; import { repoUrl, joinLemmyUrl, docsUrl } from "../utils"; import { GetSiteResponse } from "lemmy-js-client"; +import { VERSION } from "../version"; interface FooterProps { site: GetSiteResponse; @@ -19,7 +20,10 @@ export class Footer extends Component {