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

View file

@ -25,8 +25,12 @@ try {
} catch (error) { } catch (error) {
// If error, means git is not installed or not a git repo (could be downloaded instead of git cloned) // 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 🤞 // Fallback to random hash which should be different on every build run 🤞
commitHash = uid(); if (process.env.PHANPY_COMMIT_HASH) {
fakeCommitHash = true; commitHash = process.env.PHANPY_COMMIT_HASH;
} else {
commitHash = uid();
fakeCommitHash = true;
}
} }
const rollbarCode = fs.readFileSync( const rollbarCode = fs.readFileSync(