Minor fixes (#4095)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-11-29 16:30:16 +07:00 committed by GitHub
parent b1cc8fdbbf
commit 1b743ee6be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View File

@ -52,7 +52,7 @@ jobs:
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
cache-name: cache-node-platform
with:
path: |
common/temp

View File

@ -0,0 +1,27 @@
//
// Copyright © 2022 Hardcore Engineering Inc.
//
const child_process = require('child_process')
child_process.exec('git describe --tags --abbrev=0', (err, stdout, stderr) => {
if (err !== null) {
if (err.message.includes('No names found')) {
console.log('No git version available')
return
}
console.log('Error', err)
process.exit(1)
}
const rawVersion = stdout.trim().replace('v', '').replace('u', '').split('.')
if (rawVersion.length === 3) {
const version = {
major: parseInt(rawVersion[0]),
minor: parseInt(rawVersion[1]),
patch: parseInt(rawVersion[2])
}
const versionStr = `${version.major}.${version.minor}.${version.patch}`
console.log(`Setting version to ${versionStr}`)
child_process.exec(`npm version ${versionStr}`)
}
})