mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
build: change way to extract version
This commit is contained in:
parent
f21ccfcc30
commit
6a44f83566
1 changed files with 8 additions and 8 deletions
|
|
@ -1,11 +1,13 @@
|
|||
// inspired by: https://stackoverflow.com/questions/42155115/how-to-include-git-revision-into-angular-cli-application
|
||||
|
||||
const fs = require('fs');
|
||||
const { exec, execSync } = require('child_process');
|
||||
// const fs = require('fs');
|
||||
// const { exec, execSync } = require('child_process');
|
||||
// const revision = process.env.execSync('git rev-parse --short HEAD').toString().trim();
|
||||
// const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
||||
|
||||
const revision = execSync('git rev-parse --short HEAD').toString().trim();
|
||||
|
||||
const branch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim();
|
||||
const version = process.env.npm_package_version || 'NO_VER';
|
||||
const revision = process.env.GITHUB_SHA || 'NO_REV';
|
||||
const branch = process.env.GITHUB_SHA || 'NO_BRANCH';
|
||||
|
||||
const content = `// this file is automatically generated by git.version.ts script
|
||||
export const versions = {
|
||||
|
|
@ -14,7 +16,5 @@ export const versions = {
|
|||
branch: '${branch}',
|
||||
};
|
||||
`;
|
||||
console.log(
|
||||
`version: '${process.env.npm_package_version}', revision: '${revision}', branch: '${branch}'`,
|
||||
);
|
||||
console.log(`version: '${version}', revision: '${revision}', branch: '${branch}'`);
|
||||
fs.writeFileSync('src/environments/versions.ts', content, { encoding: 'utf8' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue