Skip to content

Add session-enabled Azure Service Bus listener and DI registration (#10) #4

Add session-enabled Azure Service Bus listener and DI registration (#10)

Add session-enabled Azure Service Bus listener and DI registration (#10) #4

Workflow file for this run

name: publish-nuget
on:
push:
branches: [ main ]
workflow_dispatch:
inputs:
version:
description: 'Override version (optional, e.g. 0.1.2)'
required: false
type: string
jobs:
pack-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test -c Release --logger trx
- name: Resolve version
id: ver
shell: bash
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
PKGVER="${{ github.event.inputs.version }}"
else
FILE=$(git ls-files '*.csproj' | head -n1)
PKGVER=$(grep -oPm1 '(?<=<Version>)[^<]+' "$FILE" || true)
if [ -z "$PKGVER" ]; then echo "Version not found in $FILE"; exit 1; fi
fi
echo "PKGVER=$PKGVER" >> $GITHUB_ENV
echo "Using version: $PKGVER"
- name: Pack
run: dotnet pack -c Release -p:Version=${PKGVER} -o ./artifacts -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
- name: Push to nuget.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY secret is not set."; exit 1
fi
dotnet nuget push "./artifacts/*.nupkg" --skip-duplicate --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
if ls ./artifacts/*.snupkg 1> /dev/null 2>&1; then
dotnet nuget push "./artifacts/*.snupkg" --skip-duplicate --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json
else
echo "No symbol packages (.snupkg) found to push."
fi