Skip to content

Commit bc20b31

Browse files
committed
Clean up
1 parent c9ea9d2 commit bc20b31

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,23 @@ jobs:
3030
uses: actions/setup-dotnet@v4.0.0
3131
with:
3232
dotnet-version: 9.0.x
33-
- name: Set version override
34-
if: github.event_name == 'pull_request' && github.head_ref != ''
33+
- name: Build
3534
run: |
36-
$gitDescribe = git describe --tags --abbrev=0 2>$null
37-
if ($gitDescribe -match '^v?(\d+\.\d+\.\d+)') {
38-
$baseVersion = $matches[1]
39-
40-
$branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', ''
41-
$version = "$baseVersion-octopus-$branchName.${{ github.run_number }}"
42-
43-
"MINVERVERSIONOVERRIDE=$version" >> $env:GITHUB_ENV
44-
}
35+
if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
36+
$gitDescribe = git describe --tags --abbrev=0 2>$null
37+
if ($gitDescribe -match '^v?(\d+\.\d+\.\d+)') {
38+
$baseVersion = $matches[1]
39+
40+
$branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', ''
41+
$version = "$baseVersion-octopus-$branchName.${{ github.run_number }}"
42+
43+
Write-Host "PR build - overriding version to: $version"
44+
$env:MINVERVERSIONOVERRIDE = $version
45+
}
46+
}
47+
48+
dotnet build LibGit2Sharp.sln --configuration Release
4549
shell: pwsh
46-
- name: Build
47-
run: dotnet build LibGit2Sharp.sln --configuration Release
4850
- name: Show version
4951
run: |
5052
$package = Get-ChildItem artifacts/package/*.nupkg | Select-Object -First 1

0 commit comments

Comments
 (0)