Change model update flow (#6155)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2024-07-26 21:03:43 +05:00 committed by GitHub
parent 66c20106ae
commit 333da656b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 34 additions and 15 deletions

View File

@ -63,6 +63,9 @@ jobs:
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Cheking model is updated...
run: node common/scripts/check_model_version.js
- name: Checking for mis-matching dependencies...
run: node common/scripts/install-run-rush.js check

View File

@ -0,0 +1,20 @@
const exec = require('child_process').exec
exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
if (err !== null) {
process.exit(1)
}
const tag = stdout.trim()
exec(`git fetch --tags && git diff ${tag} --name-only`, (err, stdout, stderr) => {
if (err !== null) {
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) {
console.log('Please update model version')
process.exit(1)
}
})
})

View File

@ -13,19 +13,14 @@
// limitations under the License.
//
const exec = require('child_process').exec
const fs = require('fs')
const path = require('path')
exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
if (err !== null) {
console.log('"0.6.0"')
}
const rawVersion = stdout.trim().replace('v', '').split('.')
if (rawVersion.length === 3) {
const version = {
major: parseInt(rawVersion[0]),
minor: parseInt(rawVersion[1]),
patch: parseInt(rawVersion[2])
}
console.log(`"${version.major}.${version.minor}.${version.patch}"`)
}
})
try {
const versionFilePath = path.resolve(__dirname, 'version.txt')
const version = fs.readFileSync(versionFilePath, 'utf8').trim()
console.log(version)
} catch (error) {
console.log('0.6.0')
}

View File

@ -0,0 +1 @@
"0.6.266"