mirror of
https://github.com/ayufan/steam-deck-tools.git
synced 2026-03-28 15:35:02 +01:00
117 lines
4.5 KiB
YAML
117 lines
4.5 KiB
YAML
name: build-performance-overlay
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
paths:
|
|
- ".github/workflows/build_performance_overlay.yaml"
|
|
- "PerformanceOverlay/**"
|
|
- "CommonHelpers/**"
|
|
- "ExternalHelpers/**"
|
|
- "XboxGameBarWidget/**"
|
|
- "scripts/install_gamebar_widget.ps1"
|
|
- "VERSION"
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/build_performance_overlay.yaml"
|
|
- "PerformanceOverlay/**"
|
|
- "CommonHelpers/**"
|
|
- "ExternalHelpers/**"
|
|
- "XboxGameBarWidget/**"
|
|
- "scripts/install_gamebar_widget.ps1"
|
|
- "VERSION"
|
|
|
|
env:
|
|
DOTNET_VERSION: "8.0.x"
|
|
APP_NAME: PerformanceOverlay
|
|
WIDGET_NAME: SteamDeckToolsGameBarWidget
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
|
|
- name: Setup MSBuild
|
|
uses: microsoft/setup-msbuild@v2
|
|
|
|
- name: Set versions
|
|
shell: pwsh
|
|
run: |
|
|
$majorVersion = (Get-Content VERSION -Raw).Trim()
|
|
$releaseVersion = "$majorVersion.${{ github.run_number }}"
|
|
"RELEASE_VERSION=$releaseVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
$segments = @($majorVersion.Split('.') | Where-Object { $_ -ne '' })
|
|
switch ($segments.Count) {
|
|
0 { $widgetVersion = "1.0.${{ github.run_number }}.0" }
|
|
1 { $widgetVersion = "$($segments[0]).0.${{ github.run_number }}.0" }
|
|
2 { $widgetVersion = "$($segments[0]).$($segments[1]).${{ github.run_number }}.0" }
|
|
default { $widgetVersion = "$($segments[0]).$($segments[1]).$($segments[2]).${{ github.run_number }}" }
|
|
}
|
|
"WIDGET_PACKAGE_VERSION=$widgetVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
- name: Restore PerformanceOverlay dependencies
|
|
run: dotnet restore PerformanceOverlay/PerformanceOverlay.csproj
|
|
|
|
- name: Build PerformanceOverlay
|
|
run: dotnet build PerformanceOverlay/PerformanceOverlay.csproj --configuration Release --output "${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}/" "/property:Version=${{ env.RELEASE_VERSION }}" "/property:ExtraDefineConstants=PRODUCTION_BUILD"
|
|
|
|
- name: Create PerformanceOverlay zip artifact
|
|
shell: pwsh
|
|
run: |
|
|
Compress-Archive -Path "${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}\*" -DestinationPath "${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}.zip"
|
|
|
|
- name: Build Game Bar widget package
|
|
shell: pwsh
|
|
run: |
|
|
$manifestPath = "XboxGameBarWidget/Package.appxmanifest"
|
|
$manifestContent = Get-Content $manifestPath -Raw
|
|
$manifestContent = [regex]::Replace(
|
|
$manifestContent,
|
|
'(<Identity\s+Name="SteamDeckToolsGameBarWidget"\s+Publisher="CN=SteamDeckTools"\s+Version=")[^"]+(")',
|
|
{
|
|
param($match)
|
|
$match.Groups[1].Value + "${{ env.WIDGET_PACKAGE_VERSION }}" + $match.Groups[2].Value
|
|
}
|
|
)
|
|
Set-Content -Path $manifestPath -Value $manifestContent -Encoding UTF8
|
|
|
|
$widgetPackageDir = Join-Path $PWD "${{ env.WIDGET_NAME }}-${{ env.RELEASE_VERSION }}"
|
|
New-Item -ItemType Directory -Path $widgetPackageDir -Force | Out-Null
|
|
|
|
msbuild XboxGameBarWidget\SteamDeckToolsGameBarWidget.csproj `
|
|
/restore `
|
|
/p:Configuration=Release `
|
|
/p:Platform=x64 `
|
|
/p:AppxBundle=Never `
|
|
/p:UapAppxPackageBuildMode=SideloadOnly `
|
|
/p:AppxPackageDir="$widgetPackageDir\\" `
|
|
/p:AppxPackageSigningEnabled=false
|
|
|
|
Copy-Item scripts\install_gamebar_widget.ps1 (Join-Path $widgetPackageDir "install_gamebar_widget.ps1") -Force
|
|
|
|
- name: Create Game Bar widget zip artifact
|
|
shell: pwsh
|
|
run: |
|
|
Compress-Archive -Path "${{ env.WIDGET_NAME }}-${{ env.RELEASE_VERSION }}\*" -DestinationPath "${{ env.WIDGET_NAME }}-${{ env.RELEASE_VERSION }}.zip"
|
|
|
|
- name: Upload PerformanceOverlay zip
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}.zip
|
|
path: ${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}.zip
|
|
retention-days: 14
|
|
|
|
- name: Upload Game Bar widget zip
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.WIDGET_NAME }}-${{ env.RELEASE_VERSION }}.zip
|
|
path: ${{ env.WIDGET_NAME }}-${{ env.RELEASE_VERSION }}.zip
|
|
retention-days: 14
|