Incorporate commit hash

This commit is contained in:
Natsu Kagami 2023-12-03 15:54:03 +01:00
parent 28fb3e4102
commit 109b919c6c
Signed by: nki
GPG key ID: 55A032EB38B49ADB
2 changed files with 9 additions and 5 deletions

View file

@ -687,10 +687,10 @@ function Settings({ onClose }) {
type="text"
class="version-string"
readOnly
size="18" // Manually calculated here
size={10 /* build time */ + (1+8) /* commit hash */ + '-dtth'.length}
value={`${__BUILD_TIME__.slice(0, 10).replace(/-/g, '.')}${
__COMMIT_HASH__ ? `.${__COMMIT_HASH__}` : ''
}`}
__COMMIT_HASH__ ? `.${__COMMIT_HASH__.slice(0, 8)}` : ''
}-dtth`}
onClick={(e) => {
e.target.select();
// Copy to clipboard

View file

@ -25,9 +25,13 @@ try {
} catch (error) {
// If error, means git is not installed or not a git repo (could be downloaded instead of git cloned)
// Fallback to random hash which should be different on every build run 🤞
if (process.env.PHANPY_COMMIT_HASH) {
commitHash = process.env.PHANPY_COMMIT_HASH;
} else {
commitHash = uid();
fakeCommitHash = true;
}
}
const rollbarCode = fs.readFileSync(
resolve(__dirname, './rollbar.js'),