Skip to content

chore: sync SDK from monorepo (v1.3.1) #7

chore: sync SDK from monorepo (v1.3.1)

chore: sync SDK from monorepo (v1.3.1) #7

Workflow file for this run

name: C# SDK Release
on:
push:
tags:
- "v*"
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Restore dependencies
run: dotnet restore RankVectors.sln
- name: Build
run: dotnet build RankVectors.sln --configuration Release --no-restore
- name: Test
run: dotnet test RankVectors.sln --configuration Release --no-build --verbosity normal || echo "Tests completed"
publish:
needs: test
runs-on: ubuntu-latest
defaults:
run:
working-directory: .
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"
- name: Update version in .csproj
run: |
VERSION="${{ steps.version.outputs.version }}"
sed -i.bak "s/<Version>.*<\/Version>/<Version>$VERSION<\/Version>/" src/RankVectors/RankVectors.csproj
rm src/RankVectors/RankVectors.csproj.bak
echo "Updated version to $VERSION"
- name: Restore dependencies
run: dotnet restore RankVectors.sln
- name: Build
run: dotnet build RankVectors.sln --configuration Release --no-restore
- name: Pack
run: dotnet pack src/RankVectors/RankVectors.csproj --configuration Release --no-build --output ./artifacts
- name: Publish to NuGet
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --skip-duplicate
# With NuGet trusted publishing, no API key is needed
# The workflow is automatically verified by NuGet via OIDC
- name: Publish notice
run: |
echo "✅ C# SDK release complete!"
echo ""
echo "Published version ${{ steps.version.outputs.version }} to NuGet"
echo ""
echo "Users can install with:"
echo " dotnet add package RankVectors --version ${{ steps.version.outputs.version }}"