diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..35adbc7 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -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)" diff --git a/next.config.ts b/next.config.ts index 1cdd52b..2068f1f 100644 --- a/next.config.ts +++ b/next.config.ts @@ -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; diff --git a/src/components/layout/sidebar.tsx b/src/components/layout/sidebar.tsx index e7b9607..fd5f052 100644 --- a/src/components/layout/sidebar.tsx +++ b/src/components/layout/sidebar.tsx @@ -52,6 +52,9 @@ export default function Sidebar() {
+
+

Build {process.env.NEXT_PUBLIC_BUILD_HASH || 'dev'}

+
); }