diff --git a/.github/workflows/dotnet-publish-prerelease.yml b/.github/workflows/dotnet-publish-prerelease.yml index 7f8228e..fef78be 100644 --- a/.github/workflows/dotnet-publish-prerelease.yml +++ b/.github/workflows/dotnet-publish-prerelease.yml @@ -20,9 +20,12 @@ jobs: dotnet-version: 8.0.x - name: Publish run: | - dotnet publish -c Release -r linux-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-x64 - dotnet publish -c Release -r win-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/win-x64 - dotnet publish -c Release -r linux-arm64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-arm64 + TAG_NAME=${{ github.ref_name }} + VERSION=${TAG_NAME#pre-v} + echo "Version is $VERSION" + dotnet publish -c Release -p:Version=$VERSION -r linux-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-x64 + dotnet publish -c Release -p:Version=$VERSION -r win-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/win-x64 + dotnet publish -c Release -p:Version=$VERSION -r linux-arm64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-arm64 cd app find . -type f -name 'appsettings.Example.json' -execdir mv {} appsettings.json \; find . -maxdepth 1 -type d ! -name '.' | xargs -I {} sh -c 'cd "{}" && zip -r "../${{ github.ref_name }}-$(basename {}).zip" *' diff --git a/.github/workflows/dotnet-publish-release.yml b/.github/workflows/dotnet-publish-release.yml index 75dc3a3..0f6009d 100644 --- a/.github/workflows/dotnet-publish-release.yml +++ b/.github/workflows/dotnet-publish-release.yml @@ -20,9 +20,12 @@ jobs: dotnet-version: 8.0.x - name: Publish run: | - dotnet publish -c Release -r linux-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-x64 - dotnet publish -c Release -r win-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/win-x64 - dotnet publish -c Release -r linux-arm64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-arm64 + TAG_NAME=${{ github.ref_name }} + VERSION=${TAG_NAME#v} + echo "Version is $VERSION" + dotnet publish -c Release -p:Version=$VERSION -r linux-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-x64 + dotnet publish -c Release -p:Version=$VERSION -r win-x64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/win-x64 + dotnet publish -c Release -p:Version=$VERSION -r linux-arm64 --self-contained -p:PublishTrimmed=true -p:PublishSingleFile=true -o app/linux-arm64 cd app find . -type f -name 'appsettings.Example.json' -execdir mv {} appsettings.json \; find . -maxdepth 1 -type d ! -name '.' | xargs -I {} sh -c 'cd "{}" && zip -r "../${{ github.ref_name }}-$(basename {}).zip" *' diff --git a/src/TokenPay/Program.cs b/src/TokenPay/Program.cs index f937851..22ff46f 100644 --- a/src/TokenPay/Program.cs +++ b/src/TokenPay/Program.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc.Razor; using Serilog; using Serilog.Events; +using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime; @@ -22,7 +23,12 @@ .WriteTo.File("logs/log-.log", rollingInterval: RollingInterval.Day) .WriteTo.Console() .CreateBootstrapLogger(); -Log.Information("-------------{value}-------------", "System Info Begin"); +Assembly assembly = Assembly.GetExecutingAssembly(); +var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); +Log.Information("-------------{value}-------------", "TokenPay Info"); +Log.Information("File Version: {value}", fileVersionInfo.FileVersion); +Log.Information("Product Version: {value}", fileVersionInfo.ProductVersion); +Log.Information("-------------{value}-------------", "System Info"); Log.Information("Platform: {value}", (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "Linux" : RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "OSX" : RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "Windows" : "Unknown")); @@ -32,11 +38,11 @@ Log.Information("X64: {value}", (Environment.Is64BitOperatingSystem ? "Yes" : "No")); Log.Information("CPU CORE: {value}", Environment.ProcessorCount); Log.Information("HostName: {value}", Environment.MachineName); -Log.Information("Version: {value}", Environment.OSVersion); +Log.Information("OSVersion: {value}", Environment.OSVersion); Log.Information("IsServerGC: {value}", GCSettings.IsServerGC); Log.Information("IsConcurrent: {value}", GC.GetGCMemoryInfo().Concurrent); Log.Information("LatencyMode: {value}", GCSettings.LatencyMode); -Log.Information("-------------{value}-------------", "System Info End"); +Log.Information("-------------{value}-------------", "Info End"); var builder = WebApplication.CreateBuilder(args); var Services = builder.Services; @@ -163,4 +169,4 @@ finally { Log.CloseAndFlush(); -} +} \ No newline at end of file