mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 13:47:26 +03:00
Change model update flow (#6155)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
66c20106ae
commit
333da656b8
3
.github/workflows/main.yml
vendored
3
.github/workflows/main.yml
vendored
@ -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
|
||||
|
||||
|
20
common/scripts/check_model_version.js
Executable file
20
common/scripts/check_model_version.js
Executable 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)
|
||||
}
|
||||
})
|
||||
})
|
@ -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')
|
||||
}
|
||||
|
1
common/scripts/version.txt
Normal file
1
common/scripts/version.txt
Normal file
@ -0,0 +1 @@
|
||||
"0.6.266"
|
Loading…
Reference in New Issue
Block a user