From 706c1e44d1da75dad1ab5418ad2870dcbc80e8a2 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Mon, 4 Jan 2021 11:12:42 -0800 Subject: [PATCH] chore: use last commit timestamp for @next builds (#4876) --- utils/update_version.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/update_version.js b/utils/update_version.js index 6b8b8b1a0e..2e6b8478a8 100755 --- a/utils/update_version.js +++ b/utils/update_version.js @@ -17,6 +17,7 @@ const fs = require('fs'); const path = require('path'); +const { execSync } = require('child_process'); const SCRIPT_NAME = path.basename(__filename); const USAGE = ` @@ -48,7 +49,10 @@ if (version === '--next') { version = packageJSON.version; if (!version.includes('-')) version += '-next'; - version += '.' + Date.now(); + const timestamp = execSync('git show -s --format=%ct HEAD', { + stdio: ['ignore', 'pipe', 'ignore'] + }).toString('utf8').trim() + '000'; + version += '.' + timestamp; console.log('Setting version to ' + version); } else { if (!version || !version.match(/^v\d+\.\d+\.\d+(-next)?$/)) {