From e08107a68c7b5946bdb7c872862b68a354c5157b Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Fri, 8 Mar 2024 13:41:35 +0100 Subject: [PATCH] adding versions This shows the current version of the build --- .github/workflows/build-docker.yml | 12 ++++++++++++ Dockerfiles/Dockerfile.frontend | 7 +++++++ scripts/local_vars.sh | 4 ++++ web/frontend/src/language/de.json | 2 +- web/frontend/src/language/en.json | 2 +- web/frontend/src/language/fr.json | 2 +- web/frontend/src/pages/Home.tsx | 2 +- 7 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 3b1819de4..43cda7b29 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -18,6 +18,14 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set env + run: | + git describe --tags + echo "REACT_APP_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV + echo "REACT_APP_BUILD=$(git describe --tags)" >> $GITHUB_ENV + echo "REACT_APP_BUILD_TIME=$(date)" >> $GITHUB_ENV - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 @@ -34,6 +42,10 @@ jobs: context: . file: Dockerfiles/Dockerfile.frontend platforms: linux/amd64 + build-args: | + REACT_APP_VERSION + REACT_APP_BUILD + REACT_APP_BUILD_TIME push: true tags: ghcr.io/c4dt/d-voting-frontend:${{ env.DockerTag }} - name: Build Backend diff --git a/Dockerfiles/Dockerfile.frontend b/Dockerfiles/Dockerfile.frontend index 77376ff36..46457046d 100644 --- a/Dockerfiles/Dockerfile.frontend +++ b/Dockerfiles/Dockerfile.frontend @@ -5,5 +5,12 @@ ENV REACT_APP_NOMOCK=on WORKDIR /web/frontend COPY ../web/frontend . RUN npm install +ARG REACT_APP_VERSION=unknown +ARG REACT_APP_BUILD=unknown +ARG REACT_APP_BUILD_TIME=after_2024_03 +ENV REACT_APP_VERSION=$REACT_APP_VERSION +ENV REACT_APP_BUILD=$REACT_APP_BUILD +ENV REACT_APP_BUILD_TIME=$REACT_APP_BUILD_TIME + ENTRYPOINT ["npm"] CMD ["start"] diff --git a/scripts/local_vars.sh b/scripts/local_vars.sh index ef28fc787..51daeb173 100644 --- a/scripts/local_vars.sh +++ b/scripts/local_vars.sh @@ -19,6 +19,10 @@ export DB_PATH="$(pwd)/nodes/llmdb" # Logging in without Gaspar and REACT_APP_SCIPER_ADMIN export REACT_APP_DEV_LOGIN="true" export REACT_APP_SCIPER_ADMIN=100100 +export REACT_APP_VERSION=$(git describe --tags --abbrev=0) +export REACT_APP_BUILD=$(git describe --tags) +export REACT_APP_BUILD_TIME=$(date) + # uncomment this to enable TLS to test gaspar #export HTTPS=true # Create random voter-IDs to allow easier testing diff --git a/web/frontend/src/language/de.json b/web/frontend/src/language/de.json index a14cc8dbf..9b4531e77 100644 --- a/web/frontend/src/language/de.json +++ b/web/frontend/src/language/de.json @@ -287,7 +287,7 @@ "enterHintLg2": "Geben Sie einen Hinweis auf Deutsch ein (optional)", "hint": "Hinweis", "invalidInput": "Bitte geben Sie eine Zahl zwischen 1 und {{max}} ein.", - "footerCopyright": "DEDIS LAB -", + "footerCopyright": "DEDIS LAB & C4DT -", "footerUnknown": "?", "footerVersion": "version:", "footerBuild": "build:", diff --git a/web/frontend/src/language/en.json b/web/frontend/src/language/en.json index 49cd1dce4..89e8bfe5f 100644 --- a/web/frontend/src/language/en.json +++ b/web/frontend/src/language/en.json @@ -288,7 +288,7 @@ "continue": "Continue", "invalidInput": "Please enter a number between 1 and {{max}}.", "hint": "Hint", - "footerCopyright": "DEDIS LAB -", + "footerCopyright": "DEDIS LAB & C4DT -", "footerUnknown": "?", "footerVersion": "version:", "footerBuild": "build:", diff --git a/web/frontend/src/language/fr.json b/web/frontend/src/language/fr.json index 4971d4ba7..cb79184cf 100644 --- a/web/frontend/src/language/fr.json +++ b/web/frontend/src/language/fr.json @@ -287,7 +287,7 @@ "enterHintLg1": "Entrer une indication en Français (optionnel)", "enterHintLg2": "Entrer une indication en Allemand (optionnel)", "invalidInput": "Entrer s'il vous plaît un nombre entre 1 et {{max}}", - "footerCopyright": "DEDIS LAB -", + "footerCopyright": "DEDIS LAB & C4DT -", "footerUnknown": "?", "footerVersion": "version:", "footerBuild": "build:", diff --git a/web/frontend/src/pages/Home.tsx b/web/frontend/src/pages/Home.tsx index 4f9732327..e565e1544 100644 --- a/web/frontend/src/pages/Home.tsx +++ b/web/frontend/src/pages/Home.tsx @@ -19,7 +19,7 @@ const Home: FC = () => { {t('homeWhatsNew')} - {t('homeJustShippedVersion')} 1.0.0 + {t('homeJustShippedVersion')} 2.0.0-rc1