feat: show version in user dropdown

This commit is contained in:
2025-06-29 18:22:09 +00:00
parent be5576c2c6
commit a7a046abd8
7 changed files with 33 additions and 6 deletions

View File

@@ -29,6 +29,10 @@ jobs:
images: srizan10/hclive
tags: latest
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
@@ -41,6 +45,8 @@ jobs:
secrets: |
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
build-args: |
commit=${{ steps.vars.outputs.sha_short }}
db:
name: Push db to Docker Hub
runs-on: ubuntu-latest

View File

@@ -7,6 +7,13 @@ const LIVE_SERVER_URL =
process.env.NODE_ENV === 'production'
? 'https://backend.hctv.srizan.dev'
: 'http://localhost:8888';
import { readFileSync } from 'node:fs';
import { execSync } from 'node:child_process';
const packageJson = JSON.parse(readFileSync('./package.json', 'utf8'));
const { version } = packageJson;
const commit = process.env.commit || execSync('git rev-parse --short HEAD')
.toString().trim();
/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
@@ -22,6 +29,8 @@ const nextConfig = {
},
env: {
LIVE_SERVER_URL,
commit,
version,
},
reactStrictMode: false,
output: 'standalone',

View File

@@ -1,6 +1,6 @@
{
"name": "@hctv/web",
"version": "0.1.0",
"version": "0.3.0",
"private": true,
"type": "module",
"scripts": {

View File

@@ -88,6 +88,17 @@ export default function Navbar(props: Props) {
<DropdownMenuGroup>
<ThemeSwitcher />
</DropdownMenuGroup>
<DropdownMenuGroup>
<p className="text-gray-500 dark:text-gray-400 text-sm px-2">
v{process.env.version}-{process.env.NODE_ENV === 'development' ? 'dev' : 'prod'}, commit{' '}
<Link
href={`https://github.com/SrIzan10/hctv/commit/${process.env.commit}`}
target="_blank"
>
{process.env.commit}
</Link>
</p>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
) : (

View File

@@ -1,7 +1,6 @@
services:
psql:
image: postgres
user: 1000:1000
environment:
POSTGRES_USER: postgres
# my condolences
@@ -29,7 +28,7 @@ services:
- ./nginx.conf:/etc/nginx/templates/nginx.conf.template
- ./html:/var/www/html
- /dev/shm/hls:/dev/shm/hls
image: flv-module
image: srizan10/flv-module
entrypoint:
- /bin/sh
- -c

View File

@@ -17,7 +17,8 @@
"db:generate": "prisma generate",
"db:migrate": "prisma migrate dev",
"db:deploy": "prisma migrate deploy",
"build": "prisma generate && tsc --build"
"build": "prisma generate && tsc --build",
"dev": "tsc --watch --preserveWatchOutput"
},
"devDependencies": {
"@types/node": "^24.0.1",

View File

@@ -9,8 +9,9 @@
"dist"
],
"scripts": {
"build": "tsup ./src/index.ts --format esm,cjs --dts"
},
"build": "tsup ./src/index.ts --format esm,cjs --dts",
"dev": "tsup ./src/index.ts --format esm,cjs --dts --watch"
},
"exports": {
".": {
"types": "./dist/index.d.mts",