diff --git a/components/Footer.tsx b/components/Footer.tsx index 64ef6bc..bbdb33e 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -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 ( <> diff --git a/next.config.js b/next.config.js index a8ce22d..646f107 100644 --- a/next.config.js +++ b/next.config.js @@ -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 () => {