From 76503e66ca5b27f8200741edfb1a5b0a0b3f7a75 Mon Sep 17 00:00:00 2001 From: MoshiMoshi0 <902882+MoshiMoshi0@users.noreply.github.com> Date: Sun, 10 Jan 2021 17:17:10 +0100 Subject: [PATCH] Add CI build number to project version when PR is merged (#338) * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml --- .github/workflows/main.yml | 46 ++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 72e1aec..9c68657 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,28 +9,60 @@ on: jobs: build: runs-on: windows-latest - if: "!contains(github.event.head_commit.message, 'ci skip')" + if: contains(github.event.head_commit.message, 'ci skip') == false steps: - uses: actions/checkout@v2 - uses: nuget/setup-nuget@v1 - uses: microsoft/setup-msbuild@v1.0.2 + + - uses: dorny/paths-filter@v2 + 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($_, '(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-]+)*))?'); + if(!$m.Success -or $m.Groups[4].Success -or $m.Groups[5].Success) { $_; } + else { $_ -replace $m.Value, ("{0}.{1}.{2}-ci${{ github.run_number }}" -f $m.Groups[1].Value,$m.Groups[2].Value,([convert]::ToInt32($m.Groups[3].Value)+1)); } + } | Set-Content Directory.Build.props - name: NuGet restore run: nuget restore LibreHardwareMonitor.sln - name: Build run: msbuild LibreHardwareMonitor.sln -p:Configuration=Release -m - - - uses: actions/upload-artifact@v2 + + - name: Publish net452 + uses: actions/upload-artifact@v2 with: - name: Binaries + name: LibreHardwareMonitor-net452 path: | bin/Release/net452 - - - uses: actions/upload-artifact@v2 + + - name: Publish netstandard20 + uses: actions/upload-artifact@v2 with: - name: NuGet + name: LibreHardwareMonitorLib-netstandard20 + path: | + bin/Release/netstandard2.0 + + - name: Publish net50 + uses: actions/upload-artifact@v2 + with: + name: LibreHardwareMonitorLib-net50 + path: | + bin/Release/net5.0 + + - name: Publish nupkg + uses: actions/upload-artifact@v2 + with: + name: LibreHardwareMonitorLib-nupkg path: | bin/Release/LibreHardwareMonitorLib.*.nupkg