Skip to content

v0.7.1 - Phase 3 Foundation #15

v0.7.1 - Phase 3 Foundation

v0.7.1 - Phase 3 Foundation #15

Workflow file for this run

name: Publish to NuGet
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Package version (leave empty to use csproj version)"
required: false
type: string
jobs:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x
- name: Determine version
id: version
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION#v}"
VERSION="${VERSION#.}"
elif [[ -n "${{ inputs.version }}" ]]; then
VERSION="${{ inputs.version }}"
else
VERSION=$(grep -oP '<Version>\K[^<]+' src/ElBruno.MarkItDotNet/ElBruno.MarkItDotNet.csproj)
fi
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Invalid version: '$VERSION'"; exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "📦 Publishing version: $VERSION"
- name: Restore
run: dotnet restore ElBruno.MarkItDotNet.slnx
- name: Build
run: dotnet build ElBruno.MarkItDotNet.slnx -c Release --no-restore -p:Version=${{ steps.version.outputs.version }}
- name: Run tests (net8.0)
run: dotnet test ElBruno.MarkItDotNet.slnx -c Release --no-build --framework net8.0 --verbosity normal
- name: Run tests (net10.0)
run: dotnet test ElBruno.MarkItDotNet.slnx -c Release --no-build --framework net10.0 --verbosity normal
- name: Pack all packages
run: |
# CoreModel must be packed first — other packages depend on it
dotnet pack src/ElBruno.MarkItDotNet.CoreModel/ElBruno.MarkItDotNet.CoreModel.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet/ElBruno.MarkItDotNet.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Excel/ElBruno.MarkItDotNet.Excel.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.PowerPoint/ElBruno.MarkItDotNet.PowerPoint.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.AI/ElBruno.MarkItDotNet.AI.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Whisper/ElBruno.MarkItDotNet.Whisper.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Chunking/ElBruno.MarkItDotNet.Chunking.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Citations/ElBruno.MarkItDotNet.Citations.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.DocumentIntelligence/ElBruno.MarkItDotNet.DocumentIntelligence.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Metadata/ElBruno.MarkItDotNet.Metadata.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Quality/ElBruno.MarkItDotNet.Quality.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Security/ElBruno.MarkItDotNet.Security.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Evals/ElBruno.MarkItDotNet.Evals.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.VectorData/ElBruno.MarkItDotNet.VectorData.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.AzureSearch/ElBruno.MarkItDotNet.AzureSearch.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Sync/ElBruno.MarkItDotNet.Sync.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
dotnet pack src/ElBruno.MarkItDotNet.Cli/ElBruno.MarkItDotNet.Cli.csproj -c Release --no-build -p:Version=${{ steps.version.outputs.version }} -o artifacts
- name: NuGet login (OIDC → temp API key)
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Push to NuGet.org
run: dotnet nuget push artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload NuGet package artifact
uses: actions/upload-artifact@v4
with:
name: nupkg
path: artifacts/*.nupkg