Skip to content

Commit

Permalink
add COMMIT_ID env var to head element (#6352)
Browse files Browse the repository at this point in the history
  • Loading branch information
goplayoutside3 authored Oct 9, 2024
1 parent e6dc7db commit 4062f39
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/app-root/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import withBundleAnalyzer from '@next/bundle-analyzer'
import { execSync } from 'child_process'

const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true'
})

function commitID() {
try {
return execSync('git rev-parse HEAD').toString('utf8').trim()
} catch (error) {
return error.message
}
}

const COMMIT_ID = process.env.COMMIT_ID || commitID()

const nextConfig = {
compress: false,
env: {
COMMIT_ID
},
experimental: {
optimizePackageImports: [
'@zooniverse/react-components',
Expand Down
3 changes: 3 additions & 0 deletions packages/app-root/src/app/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export const metadata = {
twitter: {
card: 'summary',
creator: '@the_zooniverse'
},
other: {
'zooniverse:deployed_commit': process.env.COMMIT_ID
}
}

Expand Down

0 comments on commit 4062f39

Please sign in to comment.