-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add commit details to index.html file with each fresh build (…
- Loading branch information
1 parent
15a6c0e
commit adcf205
Showing
2 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const fs = require("fs"); | ||
const {execSync} = require("child_process"); | ||
|
||
// Get the last commit hash and date details | ||
const hash = execSync("git rev-parse HEAD").toString().trim(); | ||
const date = execSync("git log -1 --format=%cd").toString().trim(); | ||
|
||
// Prepare the comment to add to the file | ||
const comment = ` | ||
<!-- | ||
Commit: ${hash} | ||
Date: ${date} | ||
--> | ||
`; | ||
|
||
// Define the path to the index.html file | ||
const path = "../webserver/src/main/resources/ui/index.html"; | ||
|
||
// Read the content of index.html | ||
const content = fs.readFileSync(path, "utf8"); | ||
|
||
// Write the comment at the beginning of index.html | ||
fs.writeFileSync(path, comment + content); | ||
|
||
console.log(`Added commit details to ${path}`); |