Skip to content

Add custom provider support and improve configuration #2

Add custom provider support and improve configuration

Add custom provider support and improve configuration #2

Workflow file for this run

name: Publish
on:
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
push:
branches:
- 'main'
pull_request:
branches:
- '*'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '9.0.x' ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for version calculation
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Display dotnet version
run: dotnet --info
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build -c Release --no-restore /p:ContinuousIntegrationBuild=true
- name: Run tests
run: dotnet test -c Release --no-build --verbosity normal
# Package will be created for both target frameworks
- name: Create NuGet package
run: dotnet pack -c Release --no-build --include-symbols -p:SymbolPackageFormat=snupkg
- name: Upload NuGet Package Artifact
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
src/MailFusion/bin/Release/*.nupkg
src/MailFusion/bin/Release/*.snupkg
validate:
if: github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Download NuGet Package Artifact
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: artifacts
- name: Install Meziantou NuGet Package Validation Tool
run: dotnet tool install --global Meziantou.Framework.NuGetPackageValidation.Tool
- name: Validate NuGet Package
run: |
for package in artifacts/*.nupkg; do
echo "Validating package: $package"
meziantou.validate-nuget-package "$package"
done
publish:
if: github.ref == 'refs/heads/main'
needs: validate
runs-on: ubuntu-latest
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Download NuGet Package Artifact
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: artifacts
- name: Publish to NuGet
run: |
for package in artifacts/*.nupkg; do
dotnet nuget push "$package" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
done
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}