Skip to content
34 changes: 0 additions & 34 deletions .github/workflows/build-and-test.yml

This file was deleted.

124 changes: 124 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: CI

on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
force_nuget_publish:
description: Force NuGet publish # for non-master. The package version gets a suffix. See Create NuGet Package step
type: boolean
default: false

env:
SOLUTION: src/NLog.MailKit.sln
DOTNET_VERSION: 8.0.x

jobs:
build:
name: ${{ matrix.name }}
strategy:
matrix:
include:
- os: windows-latest
name: Build, test & NuGet package (Windows)
create_nuget_package: true
- os: ubuntu-latest
name: Build & test (Ubuntu)
create_nuget_package: false
runs-on: ${{ matrix.os }}
permissions:
contents: read

steps:
- uses: actions/checkout@v7

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Restore
run: dotnet restore ${{ env.SOLUTION }}

- name: Build
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore

- name: Test
run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-restore --no-build --logger "console;verbosity=normal"

- name: Determine version suffix
Comment thread
304NotModified marked this conversation as resolved.
if: matrix.create_nuget_package
id: version
shell: pwsh
env:
REF: ${{ github.ref }}
PR_NUMBER: ${{ github.event.pull_request.number }}
RUN_NUMBER: ${{ github.run_number }}
run: |
if ($env:REF -eq "refs/heads/master") {
echo "suffix=" >> $env:GITHUB_OUTPUT
} elseif ($env:PR_NUMBER) {
echo "suffix=pr.$($env:PR_NUMBER).ci.$($env:RUN_NUMBER)" >> $env:GITHUB_OUTPUT
} else {
echo "suffix=ci.$($env:RUN_NUMBER)" >> $env:GITHUB_OUTPUT
}

- name: Create NuGet package
if: matrix.create_nuget_package
shell: pwsh
env:
VERSION_SUFFIX: ${{ steps.version.outputs.suffix }}
run: |
if ($env:VERSION_SUFFIX) {
dotnet pack $env:SOLUTION --no-build --configuration Release --output artifacts --version-suffix "$env:VERSION_SUFFIX"
} else {
dotnet pack $env:SOLUTION --no-build --configuration Release --output artifacts

@snakefoot snakefoot Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing /p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true /p:PublishRepositoryUrl=true ?

Guess you have to replace --no-build with -no-restore. And maybe also add:

  • -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:EmbedUntrackedSources=true

}

- name: Upload NuGet package
if: matrix.create_nuget_package
uses: actions/upload-artifact@v7
with:
name: NuGetPackages
path: |
artifacts/*.nupkg
artifacts/*.snupkg
if-no-files-found: error

publish:
name: Publish NuGet package
needs: build
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
Comment thread
snakefoot marked this conversation as resolved.
(github.event_name == 'workflow_dispatch' && inputs.force_nuget_publish)
runs-on: windows-latest
permissions:
contents: read
id-token: write

steps:
- name: Download NuGet package
uses: actions/download-artifact@v7
with:
name: NuGetPackages
path: artifacts

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: NuGet login
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841 # v1.2
id: login
with:
user: ${{ secrets.NUGET_USER }}

- name: Push to NuGet.org
shell: pwsh
env:
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
run: dotnet nuget push artifacts\*.nupkg --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
92 changes: 0 additions & 92 deletions .github/workflows/nuget.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NLog.MailKit

[![NuGet](https://img.shields.io/nuget/v/NLog.MailKit.svg)](https://www.nuget.org/packages/NLog.MailKit)
[![Build and test](https://github.com/NLog/NLog.MailKit/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/NLog/NLog.MailKit/actions/workflows/build-and-test.yml)
[![Build and test](https://github.com/NLog/NLog.MailKit/actions/workflows/ci.yml/badge.svg)](https://github.com/NLog/NLog.MailKit/actions/workflows/ci.yml)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=nlog.mailkit&metric=bugs)](https://sonarcloud.io/summary/new_code?id=nlog.mailkit)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=nlog.mailkit&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=nlog.mailkit)
[![](https://sonarcloud.io/api/project_badges/measure?project=nlog.mailkit&metric=code_smells)](https://sonarcloud.io/project/issues?id=nlog.mailkit&resolved=false&types=CODE_SMELL)
Expand Down Expand Up @@ -66,7 +66,7 @@ BSD. License of MailKit is MIT


### Builds
Builds and NuGet publishing is running on GitHub actions. See [build-and-test.yml](/.github/workflows/build-and-test.yml) and [nuget.yml](/.github/workflows/nuget.yml)
Builds and NuGet publishing is running on GitHub actions. See [ci.yml](/.github/workflows/ci.yml)

SonarQube analysis is running on Azure Devops: [![SonarQube Cloud Build Status](https://dev.azure.com/NLogLogging/NLog/_apis/build/status/NLog.MailKit?branchName=master)](https://dev.azure.com/NLogLogging/NLog/_build/latest?definitionId=25&branchName=master)

Loading