use short git commit hash

This commit is contained in:
Brahim Hadriche committed 2024-04-02 12:13:15 -04:00
1 parent e73fc9ab72
commit 76a57af5a0
1 file changed
+7 -7
+7 -7
View File
@@ -12,18 +12,18 @@ if (!shell.which('git')) {
const gitStatus = shell.exec('git status --porcelain=v1');
if (gitStatus.stdout !== '') {
shell.echo('Found changed files. Aborting.');
shell.exit(1);
shell.echo('Found changed files. Aborting.');
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) {
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);
})