Skip to content

Commit cb308ba

Browse files
committed
add information about version and build date to UI
1 parent 72de20d commit cb308ba

File tree

7 files changed

+55
-18
lines changed

7 files changed

+55
-18
lines changed

.github/workflows/release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,28 @@ jobs:
2323
with:
2424
go-version: 1.25.1
2525

26+
- name: Setup Node.js
27+
uses: actions/setup-node@v5
28+
with:
29+
node-version: 24
30+
2631
- name: Check licenses and vulnerabilities
2732
run: make check
2833

34+
- name: Set version
35+
- name: Update package.json version
36+
run: |
37+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
38+
TAG_VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')
39+
else
40+
LATEST_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$' | head -n 1)
41+
[ -z "$LATEST_TAG" ] && { echo "No release tag found"; exit 1; }
42+
TAG_VERSION=$(echo "$LATEST_TAG" | sed 's/^v//')
43+
echo "Using latest tag: $LATEST_TAG"
44+
fi
45+
sed -i "s/\${VERSION}/$TAG_VERSION/g" server.json
46+
echo "Version: $TAG_VERSION"
47+
2948
- name: Run ui build
3049
run: make ui-build
3150

cmd/sql-to-logsql/web/ui/package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/sql-to-logsql/web/ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sql-to-logsql",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "${VERSION}",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -36,7 +36,7 @@
3636
},
3737
"devDependencies": {
3838
"@eslint/js": "^9.36.0",
39-
"@types/node": "^24.5.2",
39+
"@types/node": "^24.7.0",
4040
"@types/react": "^19.1.13",
4141
"@types/react-dom": "^19.1.9",
4242
"@vitejs/plugin-react": "^5.0.3",

cmd/sql-to-logsql/web/ui/src/components/docs/Docs.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,28 @@ import {Accordion, AccordionContent, AccordionItem, AccordionTrigger} from "@/co
33
import {InfoIcon, LinkIcon} from "lucide-react";
44
import {Button} from "@/components/ui/button.tsx";
55
import {Separator} from "@/components/ui/separator.tsx";
6+
import {Badge} from "@/components/ui/badge.tsx";
67

78
export function Docs() {
89
return (
910
<Card className={"w-full min-w-[20rem] max-lg:hidden"}>
1011
<CardHeader>
11-
<CardTitle>Information about SQL to LogsQL</CardTitle>
12+
<CardTitle className={"flex flex-row gap-2 items-center"}>
13+
<span>Information about SQL to LogsQL</span>
14+
<Badge variant={"outline"}>{__APP_VERSION__}</Badge>
15+
<Badge variant={"outline"}>{__BUILD_DATE__}</Badge>
16+
</CardTitle>
1217
<CardDescription>Service that helps to query VictoriaLogs with SQL</CardDescription>
1318
</CardHeader>
1419
<CardContent>
15-
<a href={"https://github.com/VictoriaMetrics/sql-to-logsql"} target={"_blank"}>
20+
<div className={"flex gap-2 items-center"}>
21+
<a href={"https://github.com/VictoriaMetrics/sql-to-logsql"} target={"_blank"}>
1622
<Button variant={"link"} className={"cursor-pointer"}>
17-
<LinkIcon />
18-
Source code and documentation
23+
<LinkIcon />
24+
Source code and documentation
1925
</Button>
20-
</a>
26+
</a>
27+
</div>
2128
<Separator className={"mt-2 ml-3"} />
2229
<Accordion
2330
type="single"

cmd/sql-to-logsql/web/ui/tsconfig.app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@
3131
]
3232
}
3333
},
34-
"include": ["src"]
34+
"include": [
35+
"src",
36+
"vite-env.d.ts"
37+
]
3538
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/// <reference types="vite/client" />
2+
3+
declare const __APP_VERSION__: string
4+
declare const __BUILD_DATE__: string

cmd/sql-to-logsql/web/ui/vite.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ export default defineConfig({
1616
"@": path.resolve(__dirname, "./src"),
1717
},
1818
},
19+
define: {
20+
'__APP_VERSION__': JSON.stringify(process.env.npm_package_version),
21+
'__BUILD_DATE__': JSON.stringify(new Date().toDateString()),
22+
},
1923
});

0 commit comments

Comments
 (0)