diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 21373176c..bc13bbd63 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -67,6 +67,8 @@ jobs: push: true context: . tags: ${{needs.prepare_release.outputs.new_web_docker_image_tags}} + build-args: CHART_VERSION="${{needs.prepare_release.outputs.new_chart_version}}" + release: runs-on: ubuntu-latest diff --git a/web/Dockerfile b/web/Dockerfile index 697fcd905..51eb3c9ea 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -7,6 +7,7 @@ COPY .compatibility ./.compatibility RUN yarn install --frozen-lockfile COPY config-overrides.js tsconfig.json ./ COPY src ./src +ARG CHART_VERSION="" RUN yarn build COPY nginx.conf ./ diff --git a/web/config-overrides.js b/web/config-overrides.js index 4f1b9757f..413eb1b24 100644 --- a/web/config-overrides.js +++ b/web/config-overrides.js @@ -7,6 +7,7 @@ This file is picked up by react-app-rewired that we use in place or react-script // This is an webpack extension to detect circular import (example: A imports B that imports A) const CircularDependencyPlugin = require("circular-dependency-plugin"); const { DefinePlugin, ProvidePlugin } = require("webpack"); +const YAML = require("yaml"); module.exports = function override(config) { if (!config.resolve.fallback) { @@ -42,7 +43,16 @@ module.exports = function override(config) { }), new DefinePlugin({ // This let us display the version number in the footer of the app. - "process.env.VERSION": JSON.stringify(process.env.npm_package_version), + "process.env.CHART_VERSION": (()=>{ + const { CHART_VERSION } = process.env; + + if( CHART_VERSION === undefined ){ + return '""'; + } + + return JSON.stringify(process.env.CHART_VERSION); + + })() }), ], ); diff --git a/web/package.json b/web/package.json index fe5cf8fe4..8e068e232 100644 --- a/web/package.json +++ b/web/package.json @@ -6,7 +6,7 @@ "scripts": { "_comment": "Yes... We're still using CRA. We'll migrate to Vite as soon as Keycloakify gets support for it", "start": "react-app-rewired start", - "build": "react-app-rewired build yarn", + "build": "react-app-rewired build", "build-keycloak-theme": "yarn build && keycloakify", "storybook": "start-storybook -p 6006", "postinstall": "cp -rf .compatibility/fs node_modules/ && generate-env-getter && copy-keycloak-resources-to-public", diff --git a/web/src/stories/App/Footer.stories.tsx b/web/src/stories/App/Footer.stories.tsx index c543aee23..a6bf42a06 100644 --- a/web/src/stories/App/Footer.stories.tsx +++ b/web/src/stories/App/Footer.stories.tsx @@ -11,7 +11,7 @@ const { meta, getStory } = getStoryFactory({ export default meta; export const View1 = getStory({ - "packageJsonVersion": "0.9.3", + "chartVersion": "4.1.1", "contributeUrl": "#", "termsLink": { "href": "https://example.com", diff --git a/web/src/ui/App/App.tsx b/web/src/ui/App/App.tsx index deae369a6..dbcbda0d6 100644 --- a/web/src/ui/App/App.tsx +++ b/web/src/ui/App/App.tsx @@ -309,7 +309,7 @@ function ContextualizedApp() {