feat: add build hash to sidebar footer and Gitea CI/CD deploy workflow
Some checks failed
Deploy to VPS / deploy (push) Has been cancelled
Some checks failed
Deploy to VPS / deploy (push) Has been cancelled
- Inject git commit short hash at build time via NEXT_PUBLIC_BUILD_HASH - Display build hash in sidebar footer for version tracking - Add Gitea Actions workflow to auto-deploy on push to master (SSH → pull → rebuild) Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
24
.gitea/workflows/deploy.yml
Normal file
24
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Deploy to VPS
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Deploy via SSH
|
||||
uses: appleboy/ssh-action@v1
|
||||
with:
|
||||
host: ${{ secrets.VPS_HOST }}
|
||||
username: ${{ secrets.VPS_USER }}
|
||||
key: ${{ secrets.VPS_SSH_KEY }}
|
||||
port: ${{ secrets.VPS_PORT || 22 }}
|
||||
script: |
|
||||
cd ${{ secrets.VPS_PROJECT_PATH || '/opt/legalai' }}
|
||||
git pull origin master
|
||||
docker compose build app
|
||||
docker compose up -d app
|
||||
echo "Deployed commit: $(git rev-parse --short HEAD)"
|
||||
@@ -1,8 +1,20 @@
|
||||
import type { NextConfig } from "next";
|
||||
import { execSync } from "child_process";
|
||||
|
||||
const commitHash = (() => {
|
||||
try {
|
||||
return execSync("git rev-parse --short HEAD").toString().trim();
|
||||
} catch {
|
||||
return "dev";
|
||||
}
|
||||
})();
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
serverExternalPackages: ["pdf-parse", "drizzle-orm", "pg"],
|
||||
env: {
|
||||
NEXT_PUBLIC_BUILD_HASH: commitHash,
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -52,6 +52,9 @@ export default function Sidebar() {
|
||||
</nav>
|
||||
|
||||
<div className="px-3 py-4 border-t border-white/10" id="tenant-switcher-slot" />
|
||||
<div className="px-6 py-3 border-t border-white/10">
|
||||
<p className="text-xs text-sidebar-text/40">Build {process.env.NEXT_PUBLIC_BUILD_HASH || 'dev'}</p>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user