feat: commit id
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
const { execFileSync } = require('node:child_process')
|
||||
|
||||
const getCommitId = () => {
|
||||
const easCommitId = process.env.EAS_BUILD_GIT_COMMIT_HASH?.trim()
|
||||
if (easCommitId) {
|
||||
return easCommitId.slice(0, 8)
|
||||
}
|
||||
|
||||
try {
|
||||
return execFileSync('git', ['rev-parse', '--short=8', 'HEAD'], {
|
||||
encoding: 'utf8',
|
||||
}).trim()
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ({ config }) => ({
|
||||
...config,
|
||||
extra: {
|
||||
...config.extra,
|
||||
commitId: getCommitId(),
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user