diff --git a/.github/workflows/build-and-pack-template.yml b/.github/workflows/build-and-pack-template.yml
new file mode 100644
index 00000000..a0224923
--- /dev/null
+++ b/.github/workflows/build-and-pack-template.yml
@@ -0,0 +1,90 @@
+name: Build and Pack NuGet
+
+on:
+ workflow_call: # Allows you to call this workflow from other workflows
+
+jobs:
+ # Building, testing and packing
+ build-test-pack:
+ name: Build, Test and Pack NuGet
+
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+
+ env:
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
+ DOTNET_NOLOGO: true
+ SOLUTION_FILE_PATH: './Mailtrap.sln'
+ TEST_SETTINGS_FILE_PATH: './tests/tests.runsettings'
+ TEST_RESULTS_DIR: './artifacts/test-results'
+ PACKAGE_DIR: './artifacts/packages'
+
+ strategy:
+ matrix:
+ platform: [anycpu]
+ configuration: [Release]
+ dotnet: [ '9.0.x' ]
+
+ steps:
+ # https://github.com/marketplace/actions/checkout
+ - name: Checkout Sources
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0 # needed to ensure MinVer will find a previous tag
+ filter: tree:0 # treeless checkout to speed up checkout
+
+ # https://github.com/marketplace/actions/setup-net-core-sdk
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ matrix.dotnet }}
+
+ - name: Restore dependencies
+ run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} --locked-mode
+
+ - name: Build
+ run: >
+ dotnet build ${{ env.SOLUTION_FILE_PATH }}
+ --configuration ${{ matrix.configuration }}
+ --no-restore
+ # -p:Version=${{ github.ref_name }} MinVer should take care of this one
+
+ # https://github.com/marketplace/actions/upload-a-build-artifact
+ - name: Publish Artifacts - Binaries
+ uses: actions/upload-artifact@v4
+ with:
+ name: Binaries
+ path: './artifacts/bin'
+
+ - name: Test
+ run: >
+ dotnet test ${{ env.SOLUTION_FILE_PATH }}
+ --configuration ${{ matrix.configuration }}
+ --settings ${{ env.TEST_SETTINGS_FILE_PATH }}
+ --results-directory ${{ env.TEST_RESULTS_DIR }}
+ --collect "XPlat Code Coverage"
+ --no-build
+ --verbosity normal
+
+ # https://github.com/marketplace/actions/upload-a-build-artifact
+ - name: Publish Artifacts - Test Results
+ uses: actions/upload-artifact@v4
+ with:
+ name: Test Results
+ path: ${{ env.TEST_RESULTS_DIR }}
+
+ - name: Pack NuGet Package
+ run: >
+ dotnet pack ${{ env.SOLUTION_FILE_PATH }}
+ --configuration ${{ matrix.configuration }}
+ --output ${{ env.PACKAGE_DIR }}
+ --no-build
+ # -p:Version=${{ github.ref_name }} MinVer should take care of this one
+
+ # https://github.com/marketplace/actions/upload-a-build-artifact
+ - name: Publish Artifacts - Packages
+ uses: actions/upload-artifact@v4
+ with:
+ name: Packages
+ path: ${{ env.PACKAGE_DIR }}/*.*nupkg
+
\ No newline at end of file
diff --git a/.github/workflows/build-and-publish-github-packages.yml b/.github/workflows/build-and-publish-github-packages.yml
new file mode 100644
index 00000000..fe7cbb86
--- /dev/null
+++ b/.github/workflows/build-and-publish-github-packages.yml
@@ -0,0 +1,55 @@
+name: Build and Publish NuGet (GitHub)
+
+on:
+ workflow_dispatch:
+ release:
+ types:
+ - published
+
+# Limiting workflow concurrency
+concurrency:
+ # Grouping by workflow, triggering event and ref name.
+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ # Building, testing and packing
+ build-test-pack:
+ uses: ./.github/workflows/build-and-pack-template.yml
+ name: Build, Test and Pack NuGet
+
+ # Publishing
+ publish:
+ name: Publish to NuGet (GitHub)
+
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+
+ env:
+ PACKAGE_DIR: 'packages'
+ PACKAGE_SOURCE: 'https://nuget.pkg.github.com/railsware/index.json'
+
+ # Add a dependency to the build job
+ needs: build-test-pack
+
+ environment:
+ name: github-packages-railsware
+
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ # https://github.com/marketplace/actions/download-a-build-artifact
+ - uses: actions/download-artifact@v4
+ with:
+ name: Packages
+ path: ${{ env.PACKAGE_DIR }}
+
+ - name: Publish NuGet Package
+ run: >
+ dotnet nuget push "${{ env.PACKAGE_DIR }}/*.nupkg"
+ --source ${{ env.PACKAGE_SOURCE }}
+ --api-key ${{ secrets.GITHUB_TOKEN }}
+ --skip-duplicate
+
\ No newline at end of file
diff --git a/.github/workflows/build-and-publish-nuget.yml b/.github/workflows/build-and-publish-nuget.yml
new file mode 100644
index 00000000..d1a03007
--- /dev/null
+++ b/.github/workflows/build-and-publish-nuget.yml
@@ -0,0 +1,52 @@
+name: Build and Publish NuGet (Public Feed)
+
+on:
+ workflow_dispatch:
+ release:
+ types:
+ - published
+
+# Limiting workflow concurrency
+concurrency:
+ # Grouping by workflow, triggering event and ref name.
+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ # Building, testing and packing
+ build-test-pack:
+ uses: ./.github/workflows/build-and-pack-template.yml
+ name: Build, Test and Pack NuGet
+
+ # Publishing
+ publish:
+ name: Publish to NuGet
+
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+
+ env:
+ PACKAGE_DIR: 'packages'
+ PACKAGE_SOURCE: 'https://api.nuget.org/v3/index.json'
+
+ # Add a dependency to the build job
+ needs: build-test-pack
+
+ environment:
+ name: nuget-railsware
+
+ steps:
+ # https://github.com/marketplace/actions/download-a-build-artifact
+ - uses: actions/download-artifact@v4
+ with:
+ name: Packages
+ path: ${{ env.PACKAGE_DIR }}
+
+ - name: Publish NuGet Package
+ run: >
+ dotnet nuget push "${{ env.PACKAGE_DIR }}/*.nupkg"
+ --source ${{ env.PACKAGE_SOURCE }}
+ --api-key ${{ secrets.NUGET_APIKEY }}
+ --skip-duplicate
+
+
\ No newline at end of file
diff --git a/.github/workflows/build-template.yml b/.github/workflows/build-template.yml
new file mode 100644
index 00000000..cdc11d8b
--- /dev/null
+++ b/.github/workflows/build-template.yml
@@ -0,0 +1,65 @@
+name: Build and Test
+
+on:
+ workflow_call: # Allows you to call this workflow from other workflows
+ inputs:
+ upload_artifacts:
+ description: 'Upload build and test artifacts'
+ type: boolean
+ required: true
+ default: false
+
+jobs:
+ build:
+ name: Build and Test
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+
+ env:
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
+ DOTNET_NOLOGO: true
+ SOLUTION_FILE_PATH: './Mailtrap.sln'
+ TEST_SETTINGS_FILE_PATH: './tests/tests.runsettings'
+ TEST_RESULTS_DIR: './artifacts/test-results'
+
+ strategy:
+ matrix:
+ platform: [anycpu]
+ configuration: [Release]
+ dotnet: ['9.0.x']
+
+ steps:
+ # https://github.com/marketplace/actions/checkout
+ - name: Checkout Sources
+ uses: actions/checkout@v4
+
+ # https://github.com/marketplace/actions/setup-net-core-sdk
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: ${{ matrix.dotnet }}
+
+ - name: Restore dependencies
+ run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} --locked-mode
+
+ - name: Build
+ run: dotnet build ${{ env.SOLUTION_FILE_PATH }} --configuration ${{ matrix.configuration }} --no-restore
+
+ # https://github.com/marketplace/actions/upload-a-build-artifact
+ - name: Publish Artifacts - Binaries
+ uses: actions/upload-artifact@v4
+ if: ${{ inputs.upload_artifacts }}
+ with:
+ name: Binaries
+ path: './artifacts/bin'
+
+ - name: Test
+ run: dotnet test ${{ env.SOLUTION_FILE_PATH }} --configuration ${{ matrix.configuration }} --settings ${{ env.TEST_SETTINGS_FILE_PATH }} --results-directory ${{ env.TEST_RESULTS_DIR }} --collect "XPlat Code Coverage" --no-build --verbosity normal
+
+ # https://github.com/marketplace/actions/upload-a-build-artifact
+ - name: Publish Artifacts - Test Results
+ uses: actions/upload-artifact@v4
+ if: ${{ inputs.upload_artifacts }}
+ with:
+ name: Test Results
+ path: ${{ env.TEST_RESULTS_DIR }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b59f57e8..0069c788 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -23,6 +23,8 @@ jobs:
timeout-minutes: 15
env:
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
+ DOTNET_NOLOGO: true
SOLUTION_FILE_PATH: './Mailtrap.sln'
TEST_SETTINGS_FILE_PATH: './tests/tests.runsettings'
TEST_RESULTS_DIR: './artifacts/test-results'
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 5bb90bee..df53c968 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -2,6 +2,7 @@
true
+
@@ -10,10 +11,14 @@
+
+
+
+
diff --git a/README.md b/README.md
index a35ad9c7..b5195365 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@

-[](https://www.nuget.org/packages/Railsware.Mailtrap)
+
+[](https://github.com/railsware/mailtrap-dotnet/pkgs/nuget/Mailtrap)
[](https://github.com/railsware/mailtrap-dotnet/actions/workflows/build.yml)
[](https://github.com/railsware/mailtrap-dotnet/blob/main/LICENSE.md)
diff --git a/build/mailtrap-nuget.props b/build/mailtrap-nuget.props
index 77137529..770fc29d 100644
--- a/build/mailtrap-nuget.props
+++ b/build/mailtrap-nuget.props
@@ -6,7 +6,7 @@
MIT
icon.png
README.md
- https://github.com/railsware/mailtrap-dotnet
+ https://railsware.github.io/mailtrap-dotnet
https://github.com/railsware/mailtrap-dotnet