|
73 | 73 | # and does not exercise our native packaging, so it is excluded here. |
74 | 74 | run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING --filter "FullyQualifiedName!~CanInspectCertificateOnClone" |
75 | 75 |
|
| 76 | + release: |
| 77 | + name: Release nupkg |
| 78 | + needs: build |
| 79 | + # On develop, attach the built LibGit2Sharp.UiPath nupkg to a GitHub Release so the interactive |
| 80 | + # feed-publish step can pull it straight from the release (gh release download) instead of |
| 81 | + # rebuilding locally. No feed push happens here — that stays a deliberate manual step. |
| 82 | + if: github.ref == 'refs/heads/develop' |
| 83 | + runs-on: ubuntu-latest |
| 84 | + permissions: |
| 85 | + contents: write |
| 86 | + steps: |
| 87 | + - name: Download packages |
| 88 | + uses: actions/download-artifact@v4 |
| 89 | + with: |
| 90 | + name: NuGet packages |
| 91 | + path: packages |
| 92 | + - name: Publish nupkg to GitHub Release |
| 93 | + shell: pwsh |
| 94 | + env: |
| 95 | + GH_TOKEN: ${{ github.token }} |
| 96 | + # This job has no checkout, so point gh at the repo explicitly — otherwise gh tries to read a |
| 97 | + # local .git and fails with "not a git repository". |
| 98 | + GH_REPO: ${{ github.repository }} |
| 99 | + run: | |
| 100 | + $ErrorActionPreference = 'Continue' |
| 101 | + $PSNativeCommandUseErrorActionPreference = $false |
| 102 | + $nupkg = Get-ChildItem packages -Recurse -File | |
| 103 | + Where-Object { $_.Extension -eq '.nupkg' } | Select-Object -First 1 |
| 104 | + if (-not $nupkg) { throw "No .nupkg found in the build artifact." } |
| 105 | + # Version = the nupkg filename minus the package-id prefix. The tag is prefixed 'pkg-' so it |
| 106 | + # is NOT a bare SemVer and MinVer ignores it (only the manual X.Y.Z-vN tag drives versions). |
| 107 | + $version = $nupkg.BaseName -replace '^LibGit2Sharp\.UiPath\.', '' |
| 108 | + $tag = "pkg-$version" |
| 109 | + Write-Host "Publishing $($nupkg.Name) to release $tag" |
| 110 | + gh release view $tag *> $null |
| 111 | + if ($LASTEXITCODE -ne 0) { |
| 112 | + gh release create $tag --target $env:GITHUB_SHA --title $tag --notes "LibGit2Sharp.UiPath $version, built from develop. Fetch with: gh release download $tag --pattern '*.nupkg'" |
| 113 | + } |
| 114 | + gh release upload $tag "$($nupkg.FullName)" --clobber |
| 115 | + if ($LASTEXITCODE -ne 0) { throw "gh release upload failed ($LASTEXITCODE)" } |
| 116 | + Write-Host "Published $($nupkg.Name) to release $tag" |
| 117 | +
|
0 commit comments