Skip to content

Commit 84a55bb

Browse files
andrei-balintclaude
andcommitted
ci: attach the built nupkg to a GitHub Release on develop
Add a release job that, on develop, publishes the LibGit2Sharp.UiPath nupkg to a GitHub Release tagged pkg-<version> (prefix keeps it out of MinVer's tag space). The interactive feed-publish step can then fetch the package from the release instead of rebuilding locally. No feed push runs in CI — that stays deliberate/manual. SKILL.md Step 3 updated to match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2d8c41d commit 84a55bb

2 files changed

Lines changed: 51 additions & 3 deletions

File tree

.claude/skills/release-libgit2-natives/SKILL.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,15 @@ number keeps climbing. Only pitfall: never tag **below** the current `v<N>`, or
154154
backwards (NuGet forbids). New upstream base → `git tag X.Y.Z-v0`. Same scheme in the nativebinaries repo.
155155

156156
**Publishing to the uipath-internal feed — done interactively from here** (like the gates: there is
157-
no CI publish job). Once the Gate B PR is merged to `develop` and CI is green, get the
158-
`LibGit2Sharp.UiPath` nupkg — download the managed CI's **NuGet packages** artifact, or build locally
159-
(`dotnet build -c Release` emits it under `bin/Packages/`, via `GeneratePackageOnBuild`).
157+
no CI publish job). Once the Gate B PR is merged to `develop`, the managed `ci.yml` builds the nupkg
158+
and attaches it to a GitHub Release **`pkg-<version>`** (e.g. `pkg-1.9.1-v14`). Pull it straight from
159+
there — no local rebuild:
160+
161+
```bash
162+
gh release download pkg-<version> --repo UiPath/libgit2sharp --pattern '*.nupkg' --dir ./pkg
163+
```
164+
165+
(Or build locally: `dotnet build -c Release` emits it under `bin/Packages/`.)
160166

161167
**Recommended — mint a short-lived Azure DevOps token via the Azure CLI** (no stored PAT, reuses your
162168
`az login` SSO):

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,45 @@ jobs:
7373
# and does not exercise our native packaging, so it is excluded here.
7474
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING --filter "FullyQualifiedName!~CanInspectCertificateOnClone"
7575

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

Comments
 (0)