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: | restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} ${{ 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... - name: Checking for mis-matching dependencies...
run: node common/scripts/install-run-rush.js check 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. // 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) => { try {
if (err !== null) { const versionFilePath = path.resolve(__dirname, 'version.txt')
console.log('"0.6.0"') const version = fs.readFileSync(versionFilePath, 'utf8').trim()
}
const rawVersion = stdout.trim().replace('v', '').split('.') console.log(version)
if (rawVersion.length === 3) { } catch (error) {
const version = { console.log('0.6.0')
major: parseInt(rawVersion[0]), }
minor: parseInt(rawVersion[1]),
patch: parseInt(rawVersion[2])
}
console.log(`"${version.major}.${version.minor}.${version.patch}"`)
}
})

View File

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