Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 21 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:

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

jobs:
build:
Expand All @@ -23,34 +22,40 @@ jobs:
matrix:
include:
- os: windows-latest
name: Build, test & NuGet package (Windows)
create_nuget_package: true
name: Build & test (Windows)
framework_args:
- os: ubuntu-latest
name: Build & test (Ubuntu)
create_nuget_package: false
framework_args:
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
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore ${{ matrix.framework_args }}

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

pack:
name: Create NuGet package
runs-on: windows-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v7

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

- name: Determine version suffix
if: matrix.create_nuget_package
id: version
shell: pwsh
env:
Expand All @@ -67,19 +72,12 @@ jobs:
}

- name: Create NuGet package
if: matrix.create_nuget_package
Comment thread
304NotModified marked this conversation as resolved.
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
}
run: dotnet pack ${{ env.SOLUTION }} --no-restore --configuration Release --output artifacts -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:EmbedUntrackedSources=true -p:ContinuousIntegrationBuild=true --version-suffix "$env:VERSION_SUFFIX"

- name: Upload NuGet package
if: matrix.create_nuget_package
uses: actions/upload-artifact@v7
with:
name: NuGetPackages
Expand All @@ -90,11 +88,11 @@ jobs:

publish:
name: Publish NuGet package
needs: build
needs: [build, pack]
if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch' && inputs.force_nuget_publish)
runs-on: windows-latest
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
Expand All @@ -106,11 +104,6 @@ jobs:
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
Expand All @@ -121,4 +114,4 @@ jobs:
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
run: dotnet nuget push "artifacts/*.nupkg" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate
1 change: 0 additions & 1 deletion src/NLog.MailKit/NLog.MailKit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ If the mail target was already available on your platform, this package will ove
<RepositoryUrl>https://github.com/NLog/NLog.MailKit.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>nlog mail mailkit netcore smtp email</PackageTags>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>NLog.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
Expand Down
Loading