feat: add application version and commit hash display in UI, update CI workflow for metadata handling
Some checks failed
Caddy Manager CI build / docker (push) Failing after 25s
Some checks failed
Caddy Manager CI build / docker (push) Failing after 25s
This commit is contained in:
@@ -32,11 +32,23 @@ jobs:
|
|||||||
cache-dependency-path: '**/packages.lock.json'
|
cache-dependency-path: '**/packages.lock.json'
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: dotnet restore --locked-mode
|
run: dotnet restore --locked-mode
|
||||||
- name: Build solution
|
- name: Application metadata
|
||||||
run: dotnet build --configuration Release --no-restore
|
id: metadata
|
||||||
|
run: |
|
||||||
|
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
echo "APP_VERSION=$(grep 'public static readonly string Version' CaddyManager/Configurations/Application/ApplicationInfo.cs | sed -E 's/.*"([^"]+)".*/\1/')" >> $GITHUB_OUTPUT
|
||||||
|
- name: Patch application info
|
||||||
|
run: |
|
||||||
|
sed -i "s/public static readonly string CommitHash = \"\[DEVELOPMENT\]\";/public static readonly string CommitHash = \"${{ steps.metadata.outputs.COMMIT_HASH }}\";/" CaddyManager/Configurations/Application/ApplicationInfo.cs
|
||||||
- name: Publish container
|
- name: Publish container
|
||||||
run: |
|
run: |
|
||||||
dotnet publish \
|
dotnet publish \
|
||||||
--configuration Release --os linux --arch x64 \
|
--configuration Release --os linux --arch x64 \
|
||||||
/t:PublishContainer -p ContainerRegistry=${{ vars.DOCKER_GITEA_DOMAIN }} \
|
/t:PublishContainer -p ContainerRegistry=${{ vars.DOCKER_GITEA_DOMAIN }} \
|
||||||
-p ContainerRepository=ebolo/caddy-manager
|
-p ContainerRepository=ebolo/caddy-manager -p:ContainerImageTags='${{ steps.metadata.outputs.APP_VERSION }};latest'
|
||||||
|
- name: Deploy to Komodo
|
||||||
|
uses: fjogeleit/http-request-action@v1
|
||||||
|
with:
|
||||||
|
url: '${{ vars.WINDMILL_DOMAIN }}/komodo/pull-stack/${{ secrets.KOMODO_STACK_ID }}'
|
||||||
|
method: 'PUT'
|
||||||
|
customHeaders: '{"Auth-Key": "${{ secrets.WINDMILL_KEY }}"}'
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
|
@using CaddyManager.Configurations.Application
|
||||||
|
|
||||||
@* Required *@
|
@* Required *@
|
||||||
<MudThemeProvider @ref="@_mudThemeProvider" @bind-IsDarkMode="@_isDarkMode"/>
|
<MudThemeProvider @ref="@_mudThemeProvider" @bind-IsDarkMode="@_isDarkMode"/><MudPopoverProvider />
|
||||||
<MudPopoverProvider />
|
|
||||||
@* Needed for dialogs *@
|
@* Needed for dialogs *@
|
||||||
<MudDialogProvider />
|
<MudDialogProvider />
|
||||||
@* Needed for snackbars *@
|
@* Needed for snackbars *@
|
||||||
@@ -16,6 +16,15 @@
|
|||||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@_drawer.ToggleDrawer" />
|
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@_drawer.ToggleDrawer" />
|
||||||
<MudText Typo="Typo.h6">Caddy Manager</MudText>
|
<MudText Typo="Typo.h6">Caddy Manager</MudText>
|
||||||
<MudSpacer />
|
<MudSpacer />
|
||||||
|
<MudText Class="mr-1" Typo="Typo.body2" Color="Color.Inherit">@ApplicationInfo.Version -</MudText>
|
||||||
|
@if(ApplicationInfo.CommitHash != "[DEVELOPMENT]")
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body2" Color="Color.Inherit">(@ApplicationInfo.CommitHash)</MudText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudText Typo="Typo.body2" Color="Color.Inherit">@ApplicationInfo.CommitHash</MudText>
|
||||||
|
}
|
||||||
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Color="Color.Inherit" Href="https://github.com/daothanhduy305/CaddyManager" Target="_blank" />
|
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Color="Color.Inherit" Href="https://github.com/daothanhduy305/CaddyManager" Target="_blank" />
|
||||||
</MudAppBar>
|
</MudAppBar>
|
||||||
<NavigationDrawer @ref="_drawer"/>
|
<NavigationDrawer @ref="_drawer"/>
|
||||||
|
|||||||
17
CaddyManager/Configurations/Application/ApplicationInfo.cs
Normal file
17
CaddyManager/Configurations/Application/ApplicationInfo.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
namespace CaddyManager.Configurations.Application;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Containing information about the application
|
||||||
|
/// </summary>
|
||||||
|
public class ApplicationInfo
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The version of the application, to be defined and tagged
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string Version = "1.0.0";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The commit hash of the application
|
||||||
|
/// </summary>
|
||||||
|
public static readonly string CommitHash = "[DEVELOPMENT]";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user