From 64a1a6a9ee23b093d724ecac48fba435e915adac Mon Sep 17 00:00:00 2001 From: CinkaFox Date: Wed, 7 May 2025 14:55:00 +0300 Subject: [PATCH] - add: automatic version change --- .github/workflows/publish_manifest.yml | 8 +++++--- Nebula.Launcher/Nebula.Launcher.csproj | 7 +++++++ Nebula.Launcher/Version.txt | Bin 0 -> 22 bytes Nebula.Launcher/ViewModels/MainViewModel.cs | 11 ++++++++++- Nebula.Launcher/Views/MainView.axaml | 4 ++-- .../Configuration/ConfigurationStandalone.cs | 2 +- Nebula.UpdateResolver/Rest/RestStandalone.cs | 1 + Nebula.UpdateResolver/UpdateCVars.cs | 2 +- 8 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 Nebula.Launcher/Version.txt diff --git a/.github/workflows/publish_manifest.yml b/.github/workflows/publish_manifest.yml index 3a49c48..8577c18 100644 --- a/.github/workflows/publish_manifest.yml +++ b/.github/workflows/publish_manifest.yml @@ -1,9 +1,9 @@ name: Publish launcher manifest and files on: - workflow_dispatch: - # schedule: - # - cron: '0 10 * * *' + push: + tags: + - 'v*' jobs: build: @@ -20,6 +20,8 @@ jobs: dotnet-version: 9.0.x - name: Install dependencies run: dotnet restore + - name: Set version + run: echo "${{ github.ref }}" > ./Nebula.Launcher/Version.txt - name: Build whole project run: dotnet build --configuration Release - name: Package launcher files diff --git a/Nebula.Launcher/Nebula.Launcher.csproj b/Nebula.Launcher/Nebula.Launcher.csproj index 7aa1311..9ab546c 100644 --- a/Nebula.Launcher/Nebula.Launcher.csproj +++ b/Nebula.Launcher/Nebula.Launcher.csproj @@ -58,6 +58,13 @@ + + + + Nebula.Launcher.Version.txt + + + diff --git a/Nebula.Launcher/Version.txt b/Nebula.Launcher/Version.txt new file mode 100644 index 0000000000000000000000000000000000000000..40893733d1e37a4947c9f69c5cab89e69f4edcd7 GIT binary patch literal 22 bcmezWFNGnMp^QP7A(tVa0mSBI;9>v(QqBb? literal 0 HcmV?d00001 diff --git a/Nebula.Launcher/ViewModels/MainViewModel.cs b/Nebula.Launcher/ViewModels/MainViewModel.cs index 3c9d6c2..5f7ce58 100644 --- a/Nebula.Launcher/ViewModels/MainViewModel.cs +++ b/Nebula.Launcher/ViewModels/MainViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.IO; using System.Linq; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; @@ -29,6 +30,7 @@ public partial class MainViewModel : ViewModelBase private readonly List _viewQueue = new(); + [ObservableProperty] private string _versionInfo = "dev"; [ObservableProperty] private ViewModelBase _currentPage; [ObservableProperty] private PopupViewModelBase? _currentPopup; [ObservableProperty] private string _currentTitle = "Default"; @@ -57,6 +59,13 @@ public partial class MainViewModel : ViewModelBase protected override void Initialise() { _logger = DebugService.GetLogger(this); + + using var stream = typeof(MainViewModel).Assembly + .GetManifestResourceStream("Nebula.Launcher.Version.txt")!; + using var streamReader = new StreamReader(stream); + + VersionInfo = streamReader.ReadLine() ?? "dev"; + InitialiseInDesignMode(); PopupMessageService.OnPopupRequired += OnPopupRequired; @@ -145,7 +154,7 @@ public partial class MainViewModel : ViewModelBase public void OpenLink() { - Helper.OpenBrowser("https://cinka.ru/nebula-launcher/"); + Helper.OpenBrowser("https://durenko.tatar/nebula"); } private void OnPopupRequired(object viewModelBase) diff --git a/Nebula.Launcher/Views/MainView.axaml b/Nebula.Launcher/Views/MainView.axaml index 3088fc9..2d0b758 100644 --- a/Nebula.Launcher/Views/MainView.axaml +++ b/Nebula.Launcher/Views/MainView.axaml @@ -117,10 +117,10 @@ Foreground="#777777" HorizontalAlignment="Left" VerticalAlignment="Center"> - https://cinka.ru/nebula-launcher/ + https://durenko.tatar/nebula/ - v0.08-a + diff --git a/Nebula.UpdateResolver/Configuration/ConfigurationStandalone.cs b/Nebula.UpdateResolver/Configuration/ConfigurationStandalone.cs index 70218ac..00c99b8 100644 --- a/Nebula.UpdateResolver/Configuration/ConfigurationStandalone.cs +++ b/Nebula.UpdateResolver/Configuration/ConfigurationStandalone.cs @@ -87,7 +87,7 @@ public static class ConfigurationStandalone } catch (Exception e) { - + Console.WriteLine(e.Message); } } diff --git a/Nebula.UpdateResolver/Rest/RestStandalone.cs b/Nebula.UpdateResolver/Rest/RestStandalone.cs index b283403..d04de41 100644 --- a/Nebula.UpdateResolver/Rest/RestStandalone.cs +++ b/Nebula.UpdateResolver/Rest/RestStandalone.cs @@ -33,6 +33,7 @@ public static class RestStandalone } catch (Exception e) { + Console.WriteLine(e.Message); return defaultValue; } } diff --git a/Nebula.UpdateResolver/UpdateCVars.cs b/Nebula.UpdateResolver/UpdateCVars.cs index 39e621d..9ba415b 100644 --- a/Nebula.UpdateResolver/UpdateCVars.cs +++ b/Nebula.UpdateResolver/UpdateCVars.cs @@ -5,7 +5,7 @@ namespace Nebula.UpdateResolver; public static class UpdateConVars { public static readonly ConVar UpdateCacheUrl = - ConVarBuilder.Build("update.url","https://cinka.ru/nebula-launcher/files/publish/release"); + ConVarBuilder.Build("update.url","https://durenko.tatar/nebula/manifest/"); public static readonly ConVar CurrentLauncherManifest = ConVarBuilder.Build("update.manifest"); } \ No newline at end of file