Skip to content

Commit

Permalink
Signed-off-by: Lawan Samarasekara <[email protected]>
Browse files Browse the repository at this point in the history
  • Loading branch information
DARKDRAGON-LK committed Apr 9, 2024
1 parent 49a9d68 commit c5c14f9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/create_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,14 @@ jobs:
run: |
sed -i "s/Current Version:.*/Current Version: 3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }} (This line will be automatically updated to reflect the latest version)/" README.md
- name: Update VersionController.java
run: echo "3.0.0.${{ steps.current_date.outputs.date }}.${{ steps.increment_counter.outputs.counter }}" > src/main/java/com/divudi/bean/common/VERSION.txt

- name: Set Git user name and email
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: Stage changes
run: |
git add VERSION.txt README.md src/main/java/com/divudi/bean/common/VERSION.txt .github/counter.txt .github/last_date.txt
git add VERSION.txt README.md .github/counter.txt .github/last_date.txt
- name: Commit version and README update
run: |
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/divudi/bean/common/VERSION.txt

This file was deleted.

7 changes: 3 additions & 4 deletions src/main/java/com/divudi/bean/common/VersionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,21 @@ public VersionController() {
* Reads the first line of the text file and checks if it contains the system version.
*/
public void readFirstLine() {
String filePath = "../".repeat(7) + fileName;
try {
// Read the first line from the file
String firstLine = Files.lines(Paths.get(filePath)).findFirst().orElse(null);
String firstLine = Files.lines(Paths.get(fileName)).findFirst().orElse(null);
if (firstLine != null && !firstLine.isEmpty()) {
// Set systemVersion to the content of the first line
systemVersion = firstLine.trim();
} else {
// If the first line is empty or the file does not exist, set systemVersion to "0.0.0.0"
systemVersion = "0.0.0.0";
systemVersion = null;
}
} catch (IOException e) {
// Handle IOException by printing the stack trace
e.printStackTrace();
// Set systemVersion to "0.0.0.0" if an IOException occurs
systemVersion = "0.0.0.0";
systemVersion = null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/resources/template/template.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<h5><h:outputLabel style="text-transform: uppercase" class="text-left" value="#{sessionController.loggedUser.department.name}"/></h5>
<h6 class="mx-2">|</h6>
<h6><h:outputLabel value="#{sessionController.loggedUser.name}"/></h6>
<h6><h:outputLabel class="text-left" value="&emsp;V.#{versionController.systemVersion}"/></h6>
<h6><h:outputLabel class="text-left" rendered="#{versionController.systemVersion ne null}" value="&emsp;V.#{versionController.systemVersion}"/></h6>
</div>
</div>

Expand Down

0 comments on commit c5c14f9

Please sign in to comment.