Skip to content

Fix NuGet pack: remove build/ targets (only buildTransitive needed), … #24

Fix NuGet pack: remove build/ targets (only buildTransitive needed), …

Fix NuGet pack: remove build/ targets (only buildTransitive needed), … #24

Workflow file for this run

name: Publish NuGet Library
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g., 1.1.1)'
required: true
type: string
env:
DOTNET_VERSION: '10.0.x'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Install wasm-tools workload
run: dotnet workload install wasm-tools
- name: Set version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF#refs/tags/v}"
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Publishing version: $VERSION"
- name: Restore dependencies
run: |
dotnet restore src/ModelingEvolution.Mjpeg/ModelingEvolution.Mjpeg.csproj
dotnet restore src/ModelingEvolution.Mjpeg.Wasm/ModelingEvolution.Mjpeg.Wasm.csproj
- name: Build libraries
run: |
dotnet build src/ModelingEvolution.Mjpeg/ModelingEvolution.Mjpeg.csproj --configuration Release --no-restore /p:Version=${{ steps.version.outputs.VERSION }}
dotnet build src/ModelingEvolution.Mjpeg.Wasm/ModelingEvolution.Mjpeg.Wasm.csproj --configuration Release --no-restore /p:Version=${{ steps.version.outputs.VERSION }}
- name: Run tests
run: |
dotnet restore src/ModelingEvolution.Mjpeg.Tests/ModelingEvolution.Mjpeg.Tests.csproj
dotnet test src/ModelingEvolution.Mjpeg.Tests/ModelingEvolution.Mjpeg.Tests.csproj --configuration Release --verbosity normal --filter "Category!=Integration"
- name: Pack NuGet packages
run: |
dotnet pack src/ModelingEvolution.Mjpeg/ModelingEvolution.Mjpeg.csproj \
--configuration Release \
--no-build \
--output ./artifacts \
/p:PackageVersion=${{ steps.version.outputs.VERSION }}
dotnet pack src/ModelingEvolution.Mjpeg.Wasm/ModelingEvolution.Mjpeg.Wasm.csproj \
--configuration Release \
--output ./artifacts \
/p:PackageVersion=${{ steps.version.outputs.VERSION }}
- name: List artifacts
run: ls -lh ./artifacts
- name: Publish to NuGet.org
run: |
dotnet nuget push "./artifacts/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Publish to ModelingEvolution NuGet
run: |
dotnet nuget push "./artifacts/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY_ME }} \
--source https://nuget.modelingevolution.com/v3/index.json \
--skip-duplicate
continue-on-error: true
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-package-${{ steps.version.outputs.VERSION }}
path: ./artifacts/*.nupkg
retention-days: 30