feat: git data

This commit is contained in:
TheClashFruit 2024-08-29 15:33:37 +02:00
parent 305e507407
commit 7991ce7ee0
Signed by: TheClashFruit
GPG key ID: 09BB24C34C2F3204
2 changed files with 16 additions and 6 deletions

View file

@ -10,13 +10,12 @@ import Link from 'next/link';
import styles from '@/styles/Footer.module.scss';
import AdBanner from './AdBanner';
import getConfig from 'next/config';
export default function Footer() {
const git = {
branch: 'dev/nextjs',
commit: {
sha: 'aa1ece3db89e03e169c0031e9319e50bd4626ffb',
},
};
const { publicRuntimeConfig } = getConfig();
const git = publicRuntimeConfig.git;
return (
<>

View file

@ -1,6 +1,10 @@
const path = require('path');
const childProcess = require('child_process');
const gitBranch = childProcess.execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
const gitCommit = childProcess.execSync('git rev-parse HEAD').toString().trim();
const gitCommitTime = childProcess.execSync('git show -s --format=%cI').toString().trim();
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
@ -29,6 +33,13 @@ const nextConfig = {
'email',
'openid'
]
},
git: {
branch: gitBranch,
commit: {
sha: gitCommit,
created: new Date(gitCommitTime)
}
}
},
generateBuildId: async () => {