generated from pi-ux-ce/dotnet_build
Compare commits
6
Commits
6b9ca34110
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
873438b4bf | ||
|
|
21b7f862f9 | ||
|
|
37fb726d63 | ||
|
|
3205ec340b | ||
|
|
23b0d4f806 | ||
|
|
0b879bdd6f |
@@ -17,10 +17,13 @@ jobs:
|
||||
run: |
|
||||
latest="${{ vars.VERSION }}"
|
||||
next_version=$(echo "$latest" | awk -F. -v OFS=. '{$NF += 1 ; print}')
|
||||
echo "Next version: $next_version"
|
||||
echo "next_version=$next_version" >> $GITHUB_ENV
|
||||
echo "${{ vars.EXECUTABLE_NAME }}"
|
||||
echo "${{ vars.RUNTIME }}"
|
||||
echo "Variables used :"
|
||||
echo "------------------------------------------------"
|
||||
echo "Next version: $next_version"
|
||||
echo "EXECUTABLE_NAME: ${{ vars.EXECUTABLE_NAME }}"
|
||||
echo "RUNTIME: ${{ vars.RUNTIME }}"
|
||||
echo "TARGET_FRAMEWORK: ${{ vars.TARGET_FRAMEWORK }}"
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
@@ -30,7 +33,7 @@ jobs:
|
||||
- name: Test with dotnet
|
||||
run: dotnet test --logger trx --results-directory "TestResults-net8.0"
|
||||
- name: Build the package
|
||||
run: dotnet build -p:Version=$next_version,FileVersion=$next_version,AssemblyVersion=$next_version,InformationalVersion=$next_version
|
||||
run: dotnet build
|
||||
- name: Publish the package
|
||||
run: dotnet publish -p:PublishSingleFile=true,AssemblyName=${{ vars.EXECUTABLE_NAME }},Version=$next_version,FileVersion=$next_version,AssemblyVersion=$next_version,InformationalVersion=$next_version --self-contained false --runtime ${{ vars.RUNTIME }}
|
||||
|
||||
@@ -39,7 +42,7 @@ jobs:
|
||||
find /workspace
|
||||
|
||||
- name: copy the release before compression
|
||||
run: cp -r /workspace/pi-ux-ce/${{ github.event.repository.name }}/bin/Release/net8.0/${{ vars.RUNTIME }}/publish/ .
|
||||
run: cp -r /workspace/pi-ux-ce/${{ github.event.repository.name }}/bin/Release/${{ vars.TARGET_FRAMEWORK }}/${{ vars.RUNTIME }}/publish/ .
|
||||
- uses: montudor/action-zip@v1
|
||||
with:
|
||||
args: zip -qq -r ${{ github.event.repository.name }}.zip publish/
|
||||
@@ -68,7 +71,7 @@ jobs:
|
||||
- name: upload latest executable version with version number
|
||||
run: |
|
||||
curl --user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
|
||||
--upload-file /workspace/pi-ux-ce/${{ github.event.repository.name }}/bin/Release/net8.0/${{ vars.RUNTIME }}/publish/${{ vars.EXECUTABLE_NAME }}.exe \
|
||||
--upload-file /workspace/pi-ux-ce/${{ github.event.repository.name }}/bin/Release/${{ vars.TARGET_FRAMEWORK }}/${{ vars.RUNTIME }}/publish/${{ vars.EXECUTABLE_NAME }}.exe \
|
||||
"https://gitea.tryton.geeraert.eu/api/packages/pi-ux-ce/generic/${{ github.event.repository.name }}/$next_version/${{ github.event.repository.name }}.exe"
|
||||
|
||||
|
||||
@@ -80,7 +83,7 @@ jobs:
|
||||
- name: upload latest executable version
|
||||
run: |
|
||||
curl --user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
|
||||
--upload-file /workspace/pi-ux-ce/${{ github.event.repository.name }}/bin/Release/net8.0/${{ vars.RUNTIME }}/publish/${{ vars.EXECUTABLE_NAME }}.exe \
|
||||
--upload-file /workspace/pi-ux-ce/${{ github.event.repository.name }}/bin/Release/${{ vars.TARGET_FRAMEWORK }}/${{ vars.RUNTIME }}/publish/${{ vars.EXECUTABLE_NAME }}.exe \
|
||||
https://gitea.tryton.geeraert.eu/api/packages/pi-ux-ce/generic/${{ github.event.repository.name }}/latest/${{ vars.EXECUTABLE_NAME }}.exe
|
||||
|
||||
|
||||
|
||||
+74
-1
@@ -1,5 +1,7 @@
|
||||
using System.Configuration;
|
||||
using System.Configuration.Internal;
|
||||
using System.Diagnostics;
|
||||
|
||||
//using Microsoft.Extensions.Configuration;
|
||||
namespace PrometheusServiceManager;
|
||||
using System.ServiceProcess;
|
||||
@@ -10,13 +12,14 @@ using System.ServiceProcess;
|
||||
// V1.1 adding the Administrator option at the start
|
||||
// cancelled as the program would crash , to be investigated
|
||||
// V1.2 displaying starting complete 2025/10/15
|
||||
// V1.3 detect stuck processes and kill them
|
||||
static class Program
|
||||
{
|
||||
private static readonly Dictionary<string,string> ServicesList = ConfigurationManager.AppSettings.AllKeys.ToDictionary(key => key, key => ConfigurationManager.AppSettings[key]);
|
||||
public static bool KeycloakHidden = true;
|
||||
public static bool PostgreSqlHidden = true;
|
||||
|
||||
public static readonly string version = "V1.2";
|
||||
public static readonly string version = "V1.3";
|
||||
|
||||
[STAThread]
|
||||
|
||||
@@ -85,6 +88,8 @@ static class Program
|
||||
|
||||
public static void ShutdownServices(bool keycloakRestartRequired)
|
||||
{
|
||||
//DisplayNetstat();
|
||||
Thread.Sleep(TimeSpan.FromSeconds(3));
|
||||
if(!Form1.KeycloakCheckBox.Checked)
|
||||
{
|
||||
Console.WriteLine("Keycloak unchecked");
|
||||
@@ -103,6 +108,25 @@ static class Program
|
||||
//wait 1 second before
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
|
||||
//check if there is a process still active
|
||||
Process[] localByName = Process.GetProcessesByName(Service.Value);
|
||||
if (localByName.Length > 0)
|
||||
{
|
||||
Form1.TextDisplay.Text = "there is a process running ";
|
||||
Form1.TextDisplay.Update();
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
|
||||
//loop through every process if multiples
|
||||
foreach (Process process in localByName)
|
||||
{
|
||||
process.Kill();
|
||||
}
|
||||
|
||||
Form1.TextDisplay.Text = "kill done ";
|
||||
Form1.TextDisplay.Update();
|
||||
|
||||
}
|
||||
|
||||
//displaying end of operation
|
||||
Form1.TextDisplay.Text = "Stopping complete ! ";
|
||||
Form1.TextDisplay.Update();
|
||||
@@ -157,12 +181,61 @@ static class Program
|
||||
//wait 1 second before
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
|
||||
//check if there is a process still active
|
||||
Process[] localByName = Process.GetProcessesByName(Service.Value);
|
||||
if (localByName.Length > 0)
|
||||
{
|
||||
Form1.TextDisplay.Text = "there is a process running ";
|
||||
Form1.TextDisplay.Update();
|
||||
Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||
|
||||
//loop through every process if multiples
|
||||
foreach (Process process in localByName)
|
||||
{
|
||||
process.Kill();
|
||||
}
|
||||
|
||||
Form1.TextDisplay.Text = "kill done ";
|
||||
Form1.TextDisplay.Update();
|
||||
|
||||
}
|
||||
|
||||
//displaying end of operation
|
||||
Form1.TextDisplay.Text = "Starting complete ! ";
|
||||
Form1.TextDisplay.Update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void DisplayNetstat()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Process[] localByName = Process.GetProcessesByName("TurnaroundService.api");
|
||||
if (localByName.Length > 0)
|
||||
{
|
||||
Form1.TextDisplay.Text = "there is a service running ";
|
||||
Form1.TextDisplay.Update();
|
||||
Thread.Sleep(TimeSpan.FromSeconds(2));
|
||||
localByName[0].Kill();
|
||||
Form1.TextDisplay.Text = "kill done ";
|
||||
Form1.TextDisplay.Update();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Form1.TextDisplay.Text = "Kill failed ! ";
|
||||
Form1.TextDisplay.Update();
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void Main()
|
||||
{
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
<Authors>Pierre Geeraert</Authors>
|
||||
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
|
||||
<!-- Versioning properties -->
|
||||
|
||||
<!-- Company information -->
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -6,7 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>webclip_webclip-Photoroom.ico</ApplicationIcon>
|
||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||
<ApplicationIcon>prometheus.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user