Skip to content

Commit

Permalink
Add display of version and build run
Browse files Browse the repository at this point in the history
  • Loading branch information
sondreb committed Dec 28, 2024
1 parent 627988c commit 6d53bbb
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ jobs:
node-version: '22'
cache: 'npm'

- name: Version
run: |
BASE_VERSION=$(npm run get-version --silent)
# Remove last digit and dot, then append run number
VERSION=$(echo $BASE_VERSION | sed 's/\.[0-9]*$/.'${{ github.run_number }}/)
echo "VERSION=$VERSION" >> $GITHUB_ENV
shell: bash

- name: Update package.json version
run: npm version $VERSION --no-git-tag-version
shell: bash

- name: Install dependencies
run: npm ci

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "angor-profile",
"version": "0.0.0",
"version": "0.1.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"get-version": "node -p \"require('./package.json').version\""
},
"private": true,
"dependencies": {
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { RouterOutlet, RouterLink } from '@angular/router';
import { CommonModule } from '@angular/common';
import { ThemeService } from './services/theme.service';
import { environment } from '../environment';

@Component({
selector: 'app-root',
Expand Down Expand Up @@ -80,7 +81,7 @@ import { ThemeService } from './services/theme.service';
</div>
</div>
<div class="footer-bottom">
<p>&copy; 2024 Angor Profile. All rights reserved.</p>
<p>&copy; 2024 Angor Profile. All rights reserved. Version {{ version }}.</p>
</div>
</footer>
`,
Expand Down Expand Up @@ -226,6 +227,8 @@ import { ThemeService } from './services/theme.service';
export class AppComponent {
title = 'angor-profile';

version = environment.appVersion

constructor(public themeService: ThemeService) {}

toggleTheme() {
Expand Down
5 changes: 5 additions & 0 deletions src/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { version } from '../package.json';

export const environment = {
appVersion: version,
};
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"moduleResolution": "bundler",
"importHelpers": true,
"target": "ES2022",
"module": "ES2022"
"module": "ES2022",
"resolveJsonModule": true
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down

0 comments on commit 6d53bbb

Please sign in to comment.