2024-07-26 19:03:43 +03:00
|
|
|
const exec = require('child_process').exec
|
|
|
|
|
2024-08-01 13:20:20 +03:00
|
|
|
exec('git describe --tags `git rev-list --tags --max-count=1`', (err, stdout, stderr) => {
|
2024-07-26 19:03:43 +03:00
|
|
|
if (err !== null) {
|
2024-08-02 17:36:51 +03:00
|
|
|
console.log('Error', err)
|
2024-07-26 19:03:43 +03:00
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
const tag = stdout.trim()
|
2024-08-02 07:48:12 +03:00
|
|
|
console.log('Check changes for tag:', tag)
|
2024-07-26 19:03:43 +03:00
|
|
|
exec(`git fetch --tags && git diff ${tag} --name-only`, (err, stdout, stderr) => {
|
|
|
|
if (err !== null) {
|
2024-08-02 17:36:51 +03:00
|
|
|
console.log('Error', err)
|
2024-07-26 19:03:43 +03:00
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
const changedFiles = stdout.trim().split('\n')
|
|
|
|
const modelsChanged = changedFiles.some(file => file.startsWith('models/'))
|
|
|
|
const versionChanged = changedFiles.some(file => file.endsWith('version.txt'))
|
|
|
|
if (modelsChanged && !versionChanged) {
|
2024-08-02 07:48:12 +03:00
|
|
|
throw new Error('Please update model version')
|
2024-07-26 19:03:43 +03:00
|
|
|
}
|
2024-08-02 07:48:12 +03:00
|
|
|
console.log('OK')
|
2024-07-26 19:03:43 +03:00
|
|
|
})
|
|
|
|
})
|