Skip to content

Commit 01173c9

Browse files
committed
Clean up
1 parent c212524 commit 01173c9

File tree

1 file changed

+12
-33
lines changed

1 file changed

+12
-33
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -26,44 +26,23 @@ jobs:
2626
uses: actions/checkout@v4.1.2
2727
with:
2828
fetch-depth: 0
29-
- name: Show build info
30-
run: |
31-
Write-Host "Building commit: $(git rev-parse HEAD)"
32-
Write-Host "Short hash: $(git rev-parse --short HEAD)"
33-
Write-Host "Git describe: $(git describe --tags)"
34-
Write-Host "Branch: ${{ github.ref_name }}"
35-
Write-Host "Event: ${{ github.event_name }}"
36-
Write-Host "Head ref: ${{ github.head_ref }}"
37-
shell: pwsh
38-
- name: Set version override
39-
run: |
40-
# For PR builds, use the source branch name and ignore height
41-
if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
42-
$branchName = "${{ github.head_ref }}"
43-
Write-Host "PR build from branch: $branchName"
44-
45-
# Sanitize branch name for version (replace invalid chars with dash)
46-
$branchName = $branchName -replace '[/\\]', '-'
47-
$branchName = $branchName -replace '[^a-zA-Z0-9\-]', ''
48-
49-
# Set the pre-release identifier
50-
$preRelease = "octopus-$branchName.${{ github.run_number }}"
51-
Write-Host "Setting MinVerDefaultPreReleaseIdentifiers to: $preRelease"
52-
"MINVERDEFAULTPRERELEASEIDENTIFIERS=$preRelease" >> $env:GITHUB_ENV
53-
54-
# Ignore height - use run number instead
55-
Write-Host "Ignoring git height"
56-
"MINVERIGNOHEIGHT=true" >> $env:GITHUB_ENV
57-
} else {
58-
Write-Host "Not a PR build - using standard MinVer behavior"
59-
}
60-
shell: pwsh
6129
- name: Install .NET SDK
6230
uses: actions/setup-dotnet@v4.0.0
6331
with:
6432
dotnet-version: 9.0.x
6533
- name: Build
66-
run: dotnet build LibGit2Sharp.sln --configuration Release
34+
run: |
35+
# Set version override for PR builds
36+
if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
37+
$branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', ''
38+
$env:MINVERDEFAULTPRERELEASEIDENTIFIERS = "octopus-$branchName.${{ github.run_number }}"
39+
$env:MINVERIGNOHEIGHT = "true"
40+
Write-Host "PR build - using version override: $env:MINVERDEFAULTPRERELEASEIDENTIFIERS (height ignored)"
41+
}
42+
43+
# Build
44+
dotnet build LibGit2Sharp.sln --configuration Release
45+
shell: pwsh
6746
- name: Show version
6847
run: |
6948
$package = Get-ChildItem artifacts/package/*.nupkg | Select-Object -First 1

0 commit comments

Comments
 (0)