use short git commit hash
This commit is contained in:
1 parent
e73fc9ab72
commit
76a57af5a0
1 file changed
+7
-7
@@ -12,18 +12,18 @@ if (!shell.which('git')) {
|
|||||||
|
|
||||||
const gitStatus = shell.exec('git status --porcelain=v1');
|
const gitStatus = shell.exec('git status --porcelain=v1');
|
||||||
if (gitStatus.stdout !== '') {
|
if (gitStatus.stdout !== '') {
|
||||||
shell.echo('Found changed files. Aborting.');
|
shell.echo('Found changed files. Aborting.');
|
||||||
shell.exit(1);
|
shell.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const gitCommitHash = shell.exec('git rev-parse HEAD').stdout.trim();
|
const gitCommitHash = shell.exec('git rev-parse --short HEAD').stdout.trim();
|
||||||
|
|
||||||
["playlet-app/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
|
["playlet-app/src/manifest", "playlet-lib/src/manifest"].forEach(function (manifestPath) {
|
||||||
let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
|
let appManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' });
|
||||||
|
|
||||||
const gitHashPattern = /git_commit_sha=(\w+)/;
|
const gitHashPattern = /git_commit_sha=(\w+)/;
|
||||||
|
|
||||||
appManifestContent = appManifestContent.replace(gitHashPattern, `git_commit_sha=${gitCommitHash}`);
|
appManifestContent = appManifestContent.replace(gitHashPattern, `git_commit_sha=${gitCommitHash}`);
|
||||||
|
|
||||||
fs.writeFileSync(manifestPath, appManifestContent);
|
fs.writeFileSync(manifestPath, appManifestContent);
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user