From 43ba23a83f557d1bfb0b0611f023b5f6b1e375ef Mon Sep 17 00:00:00 2001 From: Kyrylo Shmidt Date: Sat, 14 Dec 2024 01:07:44 +0100 Subject: [PATCH] Add bump version workflow, display version in index.html --- .github/workflows/digma-bump.yml | 36 +++++++++++++++++++++++++++++++ packages/jaeger-ui/index.html | 1 + packages/jaeger-ui/package.json | 1 + packages/jaeger-ui/vite.config.ts | 13 +++++++++++ 4 files changed, 51 insertions(+) create mode 100644 .github/workflows/digma-bump.yml diff --git a/.github/workflows/digma-bump.yml b/.github/workflows/digma-bump.yml new file mode 100644 index 0000000000..8e66aabaee --- /dev/null +++ b/.github/workflows/digma-bump.yml @@ -0,0 +1,36 @@ +name: Bump Digma Jaeger UI version and push git tag + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to set (e.g., 1.2.3)' + required: true + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.RELEASE_PAT }} + + - run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Get version + run: | + VERSION=$(jq -r '.version' ./packages/jaeger-ui/package.json) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Update digma-jaeger-ui version + run: | + jq '.["digma-jaeger-ui-version"] = "${{ inputs.version }}"' ./packages/jaeger-ui/package.json > tmp.$$.json && mv tmp.$$.json ./packages/jaeger-ui/package.json + + - run: | + git add packages/jaeger-ui/package.json + git commit -m "Bump Digma Jaeger UI version to ${{ inputs.version }} [skip ci]" + git tag "v${{ env.VERSION }}-digma.${{ inputs.version }}" + git push + git push origin "v${{ inputs.version }}" diff --git a/packages/jaeger-ui/index.html b/packages/jaeger-ui/index.html index b11fe17a68..70f93e7a6a 100644 --- a/packages/jaeger-ui/index.html +++ b/packages/jaeger-ui/index.html @@ -3,6 +3,7 @@ + diff --git a/packages/jaeger-ui/package.json b/packages/jaeger-ui/package.json index 4f0bcc0621..c3cc11ad02 100644 --- a/packages/jaeger-ui/package.json +++ b/packages/jaeger-ui/package.json @@ -2,6 +2,7 @@ "private": true, "name": "jaeger-ui", "version": "1.29.1", + "digma-jaeger-ui-version": "1.0.2", "main": "src/index.tsx", "license": "Apache-2.0", "homepage": ".", diff --git a/packages/jaeger-ui/vite.config.ts b/packages/jaeger-ui/vite.config.ts index d5980afbcc..c7d9aa1289 100644 --- a/packages/jaeger-ui/vite.config.ts +++ b/packages/jaeger-ui/vite.config.ts @@ -18,6 +18,8 @@ import react from '@vitejs/plugin-react'; import legacy from '@vitejs/plugin-legacy'; import vitePluginImp from 'vite-plugin-imp'; import visualizer from 'rollup-plugin-visualizer'; +import { readFileSync } from 'fs'; +import { resolve } from 'path'; const proxyConfig = { target: 'http://localhost:16686', @@ -27,6 +29,8 @@ const proxyConfig = { xfwd: true, }; +const packageJson = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8')); + // https://vitejs.dev/config/ export default defineConfig({ define: { @@ -61,6 +65,15 @@ export default defineConfig({ }), // Generate a bundle size breakdown. visualizer(), + { + name: 'html-transform', + transformIndexHtml(html) { + return html.replace( + '__DIGMA_JAEGER_UI_VERSION__', + `${packageJson.version}-digma.${packageJson['digma-jaeger-ui-version']}` + ); + }, + }, ], css: { preprocessorOptions: {