From b9e7f9e435986927ae60220ea25d1a0039ab81d8 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 21:47:28 +0100 Subject: [PATCH 01/20] Update Build.ps1 Get version suffix from GitHub action variables. --- Build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index f4318ea0..938f636e 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -9,8 +9,8 @@ if(Test-Path .\artifacts) { & dotnet restore --no-cache -$branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; +$branch = @{ $true = $env:GITHUB_REF_NAME; $false = $(git symbolic-ref --short -q HEAD) }[$env:GITHUB_REF_NAME -ne $NULL]; +$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[$env:GITHUB_RUN_NUMBER -ne $NULL]; $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] echo "build: Version suffix is $suffix" From 487bda28918f75cc44535ca6e2a1cb3a58fe19b6 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 21:55:48 +0100 Subject: [PATCH 02/20] Update main.yml Debug release asset upload. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9d3e581..c7bc249a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,6 +31,6 @@ jobs: draft: true title: "Release ${{ env.VERSION }}-test" files: | - \a\serilog-sinks-mssqlserver\serilog-sinks-mssqlserver\artifacts\Serilog.Sinks.MSSqlServer.5.7.0.nupkg README.md - .\artifacts\Serilog.Sinks.MSSqlServer.5.7.0-dev-local.snupkg + artifacts\Serilog.Sinks.MSSqlServer.5.7.0.snupkg + artifacts\Serilog.Sinks.MSSqlServer.${{ env.VERSION }}.snupkg From 6e10cba933fabee2c5e7be682e637805de5aa5f9 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 22:20:30 +0100 Subject: [PATCH 03/20] Update main.yml Debug release asset upload. --- .github/workflows/main.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7bc249a..b32f6f38 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ on: workflow_dispatch: jobs: - build: + Build: runs-on: windows-latest steps: - uses: actions/checkout@v2 @@ -18,7 +18,9 @@ jobs: - name: Read version from csproj run: | $selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '(.+)' - echo ("VERSION=" + $selectResult.Matches[0].Groups[1].Value) >> $env:GITHUB_ENV + $versionMatch = $selectResult.Matches[0].Groups[1].Value + echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV + echo "Found version $versionMatch" - name: Run build script run: ./Build.ps1 @@ -29,8 +31,9 @@ jobs: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "v${{ env.VERSION }}-test" draft: true - title: "Release ${{ env.VERSION }}-test" + title: "v${{ env.VERSION }}-test" files: | README.md - artifacts\Serilog.Sinks.MSSqlServer.5.7.0.snupkg + D:\a\serilog-sinks-mssqlserver\serilog-sinks-mssqlserver\artifacts\Serilog.Sinks.MSSqlServer.5.7.0.nupkg artifacts\Serilog.Sinks.MSSqlServer.${{ env.VERSION }}.snupkg + **/*.snupkg From 4600189ed3bfd127d90eb63ff32767f72b3194bc Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 22:55:04 +0100 Subject: [PATCH 04/20] Update main.yml * Fixed release asset upload (nuget files) * Conditionally run tests only on PR validation --- .github/workflows/main.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b32f6f38..e9011045 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,9 +22,18 @@ jobs: echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV echo "Found version $versionMatch" - - name: Run build script + - name: Print GitHub event + run: | + echo "GitHub event is ${{ github.event }}" + + - name: Run build + if: ${{ github.event != PullRequestEvent }} run: ./Build.ps1 - + + - name: Run build and tests + if: ${{ github.event == PullRequestEvent }} + run: ./Build.ps1 -RunTests $true + - name: Create releease uses: "marvinpinto/action-automatic-releases@latest" with: @@ -33,7 +42,5 @@ jobs: draft: true title: "v${{ env.VERSION }}-test" files: | - README.md - D:\a\serilog-sinks-mssqlserver\serilog-sinks-mssqlserver\artifacts\Serilog.Sinks.MSSqlServer.5.7.0.nupkg - artifacts\Serilog.Sinks.MSSqlServer.${{ env.VERSION }}.snupkg - **/*.snupkg + artifacts/*.nupkg + artifacts/*.snupkg From 8d1f82a8b569f5c4580978e5e392c6796bb564a1 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:03:26 +0100 Subject: [PATCH 05/20] Update main.yml Fixed syntax error. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9011045..b3cbe564 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,11 +27,11 @@ jobs: echo "GitHub event is ${{ github.event }}" - name: Run build - if: ${{ github.event != PullRequestEvent }} + if: ${{ github.event != "PullRequestEvent" }} run: ./Build.ps1 - name: Run build and tests - if: ${{ github.event == PullRequestEvent }} + if: ${{ github.event == "PullRequestEvent" }} run: ./Build.ps1 -RunTests $true - name: Create releease From b1ba65875dec2955f17836ea0caea62f9cffd211 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:11:00 +0100 Subject: [PATCH 06/20] Update main.yml * Fixed syntax error * Prepared condition for release (only on push to master) --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3cbe564..6fbe7b28 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,14 +27,15 @@ jobs: echo "GitHub event is ${{ github.event }}" - name: Run build - if: ${{ github.event != "PullRequestEvent" }} + if: ${{ github.event != 'PullRequestEvent' }} run: ./Build.ps1 - name: Run build and tests - if: ${{ github.event == "PullRequestEvent" }} + if: ${{ github.event == 'PullRequestEvent' }} run: ./Build.ps1 -RunTests $true - name: Create releease + # if: ${{ (github.event == 'PushEvent') && (github.ref == 'master') }} uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" From 2628eb23915eae9b5733d3dbe6f6d42b3d1cd4c0 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:15:24 +0100 Subject: [PATCH 07/20] Update main.yml Fixed syntax error. --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6fbe7b28..2444b52c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,18 +24,18 @@ jobs: - name: Print GitHub event run: | - echo "GitHub event is ${{ github.event }}" + echo "GitHub event is ${{ github.event.type }}" - name: Run build - if: ${{ github.event != 'PullRequestEvent' }} + if: ${{ github.event.type != 'PullRequestEvent' }} run: ./Build.ps1 - name: Run build and tests - if: ${{ github.event == 'PullRequestEvent' }} + if: ${{ github.event.type == 'PullRequestEvent' }} run: ./Build.ps1 -RunTests $true - name: Create releease - # if: ${{ (github.event == 'PushEvent') && (github.ref == 'master') }} + # if: ${{ (github.event.type == 'PushEvent') && (github.ref == 'ref/heads/master') }} uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" From f6d5d45f81b87a33365c123203cfc5b751ea549e Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:29:46 +0100 Subject: [PATCH 08/20] Update main.yml Fixed event condition. --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2444b52c..c4065c52 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,18 +24,18 @@ jobs: - name: Print GitHub event run: | - echo "GitHub event is ${{ github.event.type }}" + echo "GitHub event name is ${{ github.event_name }}" - name: Run build - if: ${{ github.event.type != 'PullRequestEvent' }} + if: ${{ github.event_name != 'PullRequestEvent' }} run: ./Build.ps1 - name: Run build and tests - if: ${{ github.event.type == 'PullRequestEvent' }} + if: ${{ github.event_name == 'PullRequestEvent' }} run: ./Build.ps1 -RunTests $true - name: Create releease - # if: ${{ (github.event.type == 'PushEvent') && (github.ref == 'ref/heads/master') }} + # if: ${{ (github.event_name == 'PushEvent') && (github.ref_name == 'master') }} uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" From f60c263ab510368986e32473125a6e2256fd42c3 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:43:30 +0100 Subject: [PATCH 09/20] Update and rename main.yml to release.yml Separate workflow for PR validation and release. --- .github/workflows/{main.yml => release.yml} | 25 +++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) rename .github/workflows/{main.yml => release.yml} (76%) diff --git a/.github/workflows/main.yml b/.github/workflows/release.yml similarity index 76% rename from .github/workflows/main.yml rename to .github/workflows/release.yml index c4065c52..878aa503 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/release.yml @@ -15,27 +15,24 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Run build + if: ${{ github.event_name == 'push' }} + run: ./Build.ps1 + + - name: Run build and tests + if: ${{ github.event_name == 'pull_request' }} + run: ./Build.ps1 -RunTests $true + - name: Read version from csproj + # if: ${{ github.event_name == 'push' }} run: | $selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '(.+)' $versionMatch = $selectResult.Matches[0].Groups[1].Value echo ("VERSION=" + $versionMatch) >> $env:GITHUB_ENV echo "Found version $versionMatch" - - name: Print GitHub event - run: | - echo "GitHub event name is ${{ github.event_name }}" - - - name: Run build - if: ${{ github.event_name != 'PullRequestEvent' }} - run: ./Build.ps1 - - - name: Run build and tests - if: ${{ github.event_name == 'PullRequestEvent' }} - run: ./Build.ps1 -RunTests $true - - - name: Create releease - # if: ${{ (github.event_name == 'PushEvent') && (github.ref_name == 'master') }} + - name: Create GitHub releease + # if: ${{ (github.event_name == 'push') && (github.ref_name == 'master') }} uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" From 352265fc2243278881ace6d7f6a816e926168105 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:43:57 +0100 Subject: [PATCH 10/20] Update release.yml Renamed workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 878aa503..e540face 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: main +name: Release on: push: From 8510fd35cee76a127e0b3176954fe2c73cfe830a Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:46:56 +0100 Subject: [PATCH 11/20] Create pr-validation.yml Separate workflow for PR validation --- .github/workflows/pr-validation.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 00000000..6427e2fd --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,17 @@ +name: PR Validation + +on: + pull_request: + branches: [ dev, master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + Build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + + - name: Run build and tests + run: ./Build.ps1 -RunTests $true From 12db0b1695386f0f9d8129649868d30f58ba06e2 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Thu, 17 Feb 2022 23:48:57 +0100 Subject: [PATCH 12/20] Update release.yml Removed obsolete steps from Release workflow --- .github/workflows/release.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e540face..8c24a444 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,7 @@ name: Release on: push: - branches: [ dev ] - pull_request: - branches: [ dev ] + branches: [ dev, master ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -16,15 +14,9 @@ jobs: - uses: actions/checkout@v2 - name: Run build - if: ${{ github.event_name == 'push' }} run: ./Build.ps1 - - name: Run build and tests - if: ${{ github.event_name == 'pull_request' }} - run: ./Build.ps1 -RunTests $true - - name: Read version from csproj - # if: ${{ github.event_name == 'push' }} run: | $selectResult = Select-String -Path ".\src\Serilog.Sinks.MSSqlServer\Serilog.Sinks.MSSqlServer.csproj" -Pattern '(.+)' $versionMatch = $selectResult.Matches[0].Groups[1].Value @@ -32,7 +24,7 @@ jobs: echo "Found version $versionMatch" - name: Create GitHub releease - # if: ${{ (github.event_name == 'push') && (github.ref_name == 'master') }} + # if: ${{ github.ref_name == 'master' }} uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" @@ -42,3 +34,5 @@ jobs: files: | artifacts/*.nupkg artifacts/*.snupkg + + # TODO: upload to nuget.org From adea193612beab5a1b015d710dbd705d51ea42a1 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Fri, 18 Feb 2022 00:04:02 +0100 Subject: [PATCH 13/20] Update Build.ps1 Added parameter RunTests in build script. --- Build.ps1 | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 938f636e..b0dd94c7 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -1,3 +1,10 @@ +[CmdletBinding()] +param ( + [Parameter(Mandatory = $false)] + [System.Boolean] + $RunTests = $false +) + echo "build: Build started" Push-Location $PSScriptRoot @@ -30,26 +37,28 @@ foreach ($src in ls src/*) { Pop-Location } -foreach ($test in ls test/*.PerformanceTests) { - Push-Location $test +if ( $RunTests -eq $true ) { + foreach ($test in ls test/*.PerformanceTests) { + Push-Location $test - echo "build: Building performance test project in $test" + echo "build: Building performance test project in $test" - & dotnet build -c Release - if($LASTEXITCODE -ne 0) { exit 2 } + & dotnet build -c Release + if($LASTEXITCODE -ne 0) { exit 2 } - Pop-Location -} + Pop-Location + } -foreach ($test in ls test/*.Tests) { - Push-Location $test + foreach ($test in ls test/*.Tests) { + Push-Location $test - echo "build: Testing project in $test" + echo "build: Testing project in $test" - & dotnet test -c Release - if($LASTEXITCODE -ne 0) { exit 3 } + & dotnet test -c Release + if($LASTEXITCODE -ne 0) { exit 3 } - Pop-Location + Pop-Location + } } Pop-Location From 812367df1523230ee67c9ce5248df0ff54e82c32 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Fri, 18 Feb 2022 00:05:02 +0100 Subject: [PATCH 14/20] Update Build.ps1 Removed extra whitespace. --- Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build.ps1 b/Build.ps1 index b0dd94c7..1886ff10 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -37,7 +37,7 @@ foreach ($src in ls src/*) { Pop-Location } -if ( $RunTests -eq $true ) { +if ($RunTests -eq $true) { foreach ($test in ls test/*.PerformanceTests) { Push-Location $test From d35f3eda506e1fdf7a5e8312c364c3c744917297 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Sat, 19 Feb 2022 23:43:27 +0100 Subject: [PATCH 15/20] Update release.yml * Added nuget publish * Build.ps1 option -SkipTest instead of -RunTests --- .github/workflows/release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c24a444..d4dd0f6b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - name: Run build - run: ./Build.ps1 + run: ./Build.ps1 -SkipTests $true - name: Read version from csproj run: | @@ -24,15 +24,15 @@ jobs: echo "Found version $versionMatch" - name: Create GitHub releease - # if: ${{ github.ref_name == 'master' }} + if: ${{ github.ref_name == 'master' }} uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "v${{ env.VERSION }}-test" - draft: true - title: "v${{ env.VERSION }}-test" + automatic_release_tag: "v${{ env.VERSION }}" + title: "v${{ env.VERSION }}" files: | artifacts/*.nupkg artifacts/*.snupkg - # TODO: upload to nuget.org + - name: Publish to nuget.org + run: nuget push artifacts\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} From 8daa96f61b49303ba5700504916d1f921ead3259 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Sat, 19 Feb 2022 23:44:13 +0100 Subject: [PATCH 16/20] Update pr-validation.yml Build.ps1 options -SkipTests instead of -RunTests --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 6427e2fd..c1acaaf8 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -14,4 +14,4 @@ jobs: - uses: actions/checkout@v2 - name: Run build and tests - run: ./Build.ps1 -RunTests $true + run: ./Build.ps1 From 66989b831de56be24ddb27e4bf22f995ef49c928 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Sat, 19 Feb 2022 23:45:25 +0100 Subject: [PATCH 17/20] Update Build.ps1 Build.ps1 options -SkipTests instead of -RunTests --- Build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 1886ff10..8b7da485 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -2,7 +2,7 @@ param ( [Parameter(Mandatory = $false)] [System.Boolean] - $RunTests = $false + $SkipTests = $false ) echo "build: Build started" @@ -37,7 +37,7 @@ foreach ($src in ls src/*) { Pop-Location } -if ($RunTests -eq $true) { +if ($SkipTests -eq $false) { foreach ($test in ls test/*.PerformanceTests) { Push-Location $test From c828f2d4fac77cb7d7a2d62b059a91bae9929f2b Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Sun, 20 Feb 2022 00:12:30 +0100 Subject: [PATCH 18/20] Update Build.ps1 Generate generic version suffix on PR validation build. --- Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build.ps1 b/Build.ps1 index 8b7da485..59263473 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -17,7 +17,7 @@ if(Test-Path .\artifacts) { & dotnet restore --no-cache $branch = @{ $true = $env:GITHUB_REF_NAME; $false = $(git symbolic-ref --short -q HEAD) }[$env:GITHUB_REF_NAME -ne $NULL]; -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[$env:GITHUB_RUN_NUMBER -ne $NULL]; +$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[($env:GITHUB_RUN_NUMBER -ne $NULL) -or ($branch -ne "master" -and $branch -ne "dev")]; $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] echo "build: Version suffix is $suffix" From 4efa8b61a4c36e3846a45d1b57abc336c1172636 Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Sun, 20 Feb 2022 00:18:55 +0100 Subject: [PATCH 19/20] Update Build.ps1 Fixed condition in build script. --- Build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build.ps1 b/Build.ps1 index 59263473..1d165139 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -17,7 +17,7 @@ if(Test-Path .\artifacts) { & dotnet restore --no-cache $branch = @{ $true = $env:GITHUB_REF_NAME; $false = $(git symbolic-ref --short -q HEAD) }[$env:GITHUB_REF_NAME -ne $NULL]; -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[($env:GITHUB_RUN_NUMBER -ne $NULL) -or ($branch -ne "master" -and $branch -ne "dev")]; +$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[($env:GITHUB_RUN_NUMBER -ne $NULL) -and ($branch -eq "master" -or $branch -eq "dev")]; $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] echo "build: Version suffix is $suffix" From f2a19b5272cc693ba1aca310333bdac9631553ff Mon Sep 17 00:00:00 2001 From: Christian Kadluba <10721825+ckadluba@users.noreply.github.com> Date: Sun, 20 Feb 2022 00:25:40 +0100 Subject: [PATCH 20/20] Update Build.ps1 Version suffix only for dev branch. --- Build.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index 1d165139..64e8b749 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -17,8 +17,8 @@ if(Test-Path .\artifacts) { & dotnet restore --no-cache $branch = @{ $true = $env:GITHUB_REF_NAME; $false = $(git symbolic-ref --short -q HEAD) }[$env:GITHUB_REF_NAME -ne $NULL]; -$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[($env:GITHUB_RUN_NUMBER -ne $NULL) -and ($branch -eq "master" -or $branch -eq "dev")]; -$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "master" -and $revision -ne "local"] +$revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:GITHUB_RUN_NUMBER, 10); $false = "local" }[$env:GITHUB_RUN_NUMBER -ne $NULL]; +$suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -ne "dev" -and $revision -ne "local"] echo "build: Version suffix is $suffix"