Skip to content

Commit 23aca64

Browse files
committed
Add appsettings.json generation and app version display
1 parent 669d0ed commit 23aca64

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,44 @@ jobs:
107107
uses: actions/upload-artifact@v4
108108
with:
109109
name: Msix-x64
110-
path: ${{ steps.set-package.outputs.x64 }}\*.msix
110+
path: ${{ steps.set-package.outputs.x64 }}\*.msix
111+
112+
- name: Create appsettings.json from secrets
113+
shell: pwsh
114+
run: |
115+
$configDir = "LCSC.App\Assets\Config"
116+
New-Item -ItemType Directory -Force -Path $configDir | Out-Null
117+
118+
# Fail fast if a required secret is missing
119+
$required = @{
120+
AIRBASE_TOKEN='${{ secrets.AIRBASE_TOKEN }}'
121+
AIRBASE_BASEID='${{ secrets.AIRBASE_BASEID }}'
122+
BNET_CLIENT_ID='${{ secrets.BNET_CLIENT_ID }}'
123+
BNET_CLIENT_SECRET='${{ secrets.BNET_CLIENT_SECRET }}'
124+
DISCORD_TOKEN='${{ secrets.DISCORD_TOKEN }}'
125+
DISCORD_CLIENT_SECRET='${{ secrets.DISCORD_CLIENT_SECRET }}'
126+
TELEMETRY_KEY='${{ secrets.TELEMETRY_KEY }}'
127+
}
128+
$missing = @()
129+
foreach($k in $required.Keys){ if([string]::IsNullOrWhiteSpace($required[$k])){ $missing += $k } }
130+
if($missing.Count -gt 0){ throw "Missing required secrets: $($missing -join ', ')" }
131+
132+
$json = @{
133+
AirBaseSettings = @{
134+
token = "${{ secrets.AIRBASE_TOKEN }}"
135+
baseId = "${{ secrets.AIRBASE_BASEID }}"
136+
}
137+
BattleNetSettings = @{
138+
clientId = "${{ secrets.BNET_CLIENT_ID }}"
139+
clientSecret = "${{ secrets.BNET_CLIENT_SECRET }}"
140+
}
141+
DiscordSettings = @{
142+
token = "${{ secrets.DISCORD_TOKEN }}"
143+
clientSecret = "${{ secrets.DISCORD_CLIENT_SECRET }}"
144+
}
145+
TelemetryKey = @{
146+
key = "${{ secrets.TELEMETRY_KEY }}"
147+
}
148+
} | ConvertTo-Json -Depth 5
149+
150+
Set-Content -Path (Join-Path $configDir 'appsettings.json') -Value $json -Encoding UTF8

LCSC.App/MainWindow.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,10 @@
4343
<views:BotUserControl />
4444
</PivotItem>
4545
</Pivot>
46+
<TextBlock Grid.Row="1"
47+
Margin="24,8"
48+
HorizontalAlignment="Right"
49+
Opacity=".6"
50+
Text="{x:Bind ViewModel.AppVersion}" />
4651
</Grid>
4752
</Window>

LCSC.App/ViewModels/MainViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using CommunityToolkit.Mvvm.ComponentModel;
22
using LCSC.App.Models.Messages;
33
using CommunityToolkit.Mvvm.Messaging;
4+
using LCTWorks.WinUI.Helpers;
45

56
namespace LCSC.App.ViewModels
67
{
@@ -22,5 +23,7 @@ public MainViewModel()
2223
public bool IsMembersViewEnabled => true;
2324

2425
public bool IsTournamentsViewEnabled => true;
26+
27+
public string AppVersion => RuntimePackageHelper.GetPackageVersion();
2528
}
2629
}

0 commit comments

Comments
 (0)