Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,28 @@ jobs:
uses: actions/setup-dotnet@v5.2.0
with:
dotnet-version: 9.0.x
- name: Compute version suffix for branch builds
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
id: version
run: |
# Sanitize branch name: lowercase, replace non-alphanumeric with hyphen, trim to 20 chars
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
SAFE_BRANCH=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//' | cut -c1-20)
echo "override=${SAFE_BRANCH}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
- name: Download artifacts
uses: actions/download-artifact@v8.0.1
with:
path: nuget.package/runtimes/
- name: Create package
run: dotnet pack nuget.package
run: dotnet pack nuget.package ${{ steps.version.outputs.override && format('/p:MinVerDefaultPreReleaseIdentifiers="{0}"', steps.version.outputs.override) || '' }}
- name: Upload NuGet package
uses: actions/upload-artifact@v7.0.0
with:
name: NuGet package
path: ./nuget.package/*.nupkg
- name: Push package to feed
shell: bash
env:
FEED_API_KEY: ${{ secrets.FEED_API_KEY }}
FEED_SOURCE: ${{ secrets.FEED_SOURCE }}
run: dotnet nuget push ./nuget.package/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE"
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ nuget.exe Pack nuget.package/NativeBinaries.nuspec -Version <version> -NoPackage
Where `<version>` is the version from the MinVer tool or manually chosen version.


## Releasing

Releases are triggered by pushing a git tag. The tag format is:

```
<upstream-version>-octopus.<n>
```

Where `<upstream-version>` is the version from the upstream libgit2sharp.nativebinaries repo (e.g., `2.0.312`) and `<n>` is an incrementing number starting at 1. The incrementing number resets to 1 when the upstream version changes.

For example, for upstream version `2.0.312`:

```
git tag 2.0.312-octopus.1
git push origin 2.0.312-octopus.1
```

This triggers CI, which builds all native binaries, packs the NuGet package with the tag as its version, and pushes it to the configured feed.


## Notes on Visual Studio

Visual Studio 2019 is required to build the Windows native binaries, however you
Expand Down
4 changes: 2 additions & 2 deletions UpdateLibgit2ToSha.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Push-Location $libgit2Directory
</Project>
"@

Set-Content -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\LibGit2Sharp.NativeBinaries.props") $buildProperties
Set-Content -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\Octopus.LibGit2Sharp.NativeBinaries.props") $buildProperties

$net46BuildProperties = @"
<Project>
Expand All @@ -116,7 +116,7 @@ Push-Location $libgit2Directory
</Project>
"@

Set-Content -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\net46\LibGit2Sharp.NativeBinaries.props") $net46BuildProperties
Set-Content -Encoding UTF8 (Join-Path $projectDirectory "nuget.package\build\net46\Octopus.LibGit2Sharp.NativeBinaries.props") $net46BuildProperties

$dllConfig = @"
<configuration>
Expand Down
1 change: 1 addition & 0 deletions nuget.package/LibGit2Sharp.NativeBinaries.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageLicenseFile>libgit2\libgit2.license.txt</PackageLicenseFile>
<PackageProjectUrl>https://github.com/libgit2/libgit2sharp.nativebinaries</PackageProjectUrl>
<PackageIcon>libgit2\libgit2.png</PackageIcon>
<PackageId>Octopus.LibGit2Sharp.NativeBinaries</PackageId>
<Description>Native binaries for LibGit2Sharp</Description>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageOutputPath>$(MSBuildThisFileDirectory)</PackageOutputPath>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)\..\build\Octopus.LibGit2Sharp.NativeBinaries.props" />
</Project>