83 lines
3.6 KiB
YAML
83 lines
3.6 KiB
YAML
name: release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: windows-2025
|
|
steps:
|
|
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
|
|
- uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
|
|
with:
|
|
dotnet-version: "10.x"
|
|
- uses: nuget/setup-nuget@fd55a6f3b34392fa83fde1454582407d8c714123 # 4.0.0
|
|
- uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # 3.0.0
|
|
with:
|
|
msbuild-architecture: x64
|
|
|
|
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # 4.0.1
|
|
id: changes
|
|
with:
|
|
filters: |
|
|
buildprops:
|
|
- 'Directory.Build.props'
|
|
|
|
- name: Update version
|
|
if: steps.changes.outputs.buildprops == 'false'
|
|
run: |
|
|
(Get-Content Directory.Build.props) | % {
|
|
$m = [regex]::match($_, '<Version>(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?</Version>');
|
|
if(!$m.Success -or $m.Groups[4].Success -or $m.Groups[5].Success) { $_; }
|
|
else { $_ -replace $m.Value, ("<Version>{0}.{1}.{2}-pre${{ github.run_number }}</Version>" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); }
|
|
} | Set-Content Directory.Build.props
|
|
|
|
- name: Restore application packages
|
|
run: dotnet restore LibreHardwareMonitor.Windows.WinUI\LibreHardwareMonitor.Windows.WinUI.csproj
|
|
|
|
- name: Build application
|
|
run: dotnet build LibreHardwareMonitor.Windows.WinUI\LibreHardwareMonitor.Windows.WinUI.csproj -c Release --no-restore -p:Platform=x64
|
|
|
|
- name: Publish WinUI application
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
|
|
with:
|
|
name: LibreHardwareMonitor.Windows.WinUI
|
|
path: |
|
|
bin/Release/net10.0-windows10.0.19041.0
|
|
|
|
- name: Restore library packages
|
|
run: dotnet restore LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj
|
|
|
|
- name: Build x64 libraries
|
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:Platform=x64
|
|
|
|
- name: Run library tests
|
|
run: dotnet test LibreHardwareMonitorLib.Tests\LibreHardwareMonitorLib.Tests.csproj -c Release -p:Platform=x64
|
|
|
|
- name: Run WinUI tests
|
|
run: dotnet test LibreHardwareMonitor.Windows.WinUI.Tests\LibreHardwareMonitor.Windows.WinUI.Tests.csproj -c Release -p:Platform=x64
|
|
|
|
- name: Publish x64 libraries
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
|
|
with:
|
|
name: LibreHardwareMonitorLib (x64)
|
|
path: |
|
|
bin/Release/x64
|
|
|
|
- name: Build reference libraries
|
|
run: dotnet build LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release --no-restore -p:BuildOnlyRefs=true
|
|
|
|
- name: Pack main nupkg
|
|
run: dotnet pack LibreHardwareMonitorLib\LibreHardwareMonitorLib.csproj -c Release -p:PackMainNuget=true --no-build --output bin\Release
|
|
|
|
- name: Publish nupkg
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
|
|
with:
|
|
name: LibreHardwareMonitorLib-nupkg
|
|
path: |
|
|
bin/Release/LibreHardwareMonitorLib.*.nupkg
|
|
|
|
- name: Publish to NuGet
|
|
if: github.repository == 'LibreHardwareMonitor/LibreHardwareMonitor'
|
|
run: nuget push bin\Release\LibreHardwareMonitorLib.*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}
|