Updated to .NET 8 #47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Publish Packages | |
on: | |
workflow_dispatch: # Allow running the workflow manually from the GitHub UI | |
push: | |
branches: | |
- 'main' # Run the workflow when pushing to the main branch | |
pull_request: | |
branches: | |
- '*' # Run the workflow for all pull requests | |
release: | |
types: | |
- published # Run the workflow when a new GitHub release is published | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
Build_and_Test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# Install the .NET SDK indicated in the global.json file | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
# Restore packages dependencies | |
- name: Install dependencies | |
run: dotnet restore | |
# Build packages | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
# Run tests | |
- name: Run tests | |
run: dotnet test --configuration Release | |
Deploy: | |
# Publish only when creating a GitHub Release | |
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository | |
# You can update this logic if you want to manage releases differently | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
needs: [ Build_and_Test ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
# Restore packages dependencies | |
- name: Install dependencies | |
run: dotnet restore | |
# Build packages | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
# Publish packages | |
- name: Pack FluentEmailer.Core | |
run: dotnet pack --no-build --configuration Release Src/FluentEmailer.Core/FluentEmailer.Core.csproj --output . | |
- name: Pack FluentEmailer.Smtp | |
run: dotnet pack --no-build --configuration Release Src/Senders/FluentEmailer.Smtp/FluentEmailer.Smtp.csproj --output . | |
- name: Pack FluentEmailer.MailerSend | |
run: dotnet pack --no-build --configuration Release Src/Senders/FluentEmailer.MailerSend/FluentEmailer.MailerSend.csproj --output . | |
- name: Pack FluentEmailer.Mailgun | |
run: dotnet pack --no-build --configuration Release Src/Senders/FluentEmailer.Mailgun/FluentEmailer.Mailgun.csproj --output . | |
- name: Pack FluentEmailer.MailKit | |
run: dotnet pack --no-build --configuration Release Src/Senders/FluentEmailer.MailKit/FluentEmailer.MailKit.csproj --output . | |
- name: Pack FluentEmailer.Mailtrap | |
run: dotnet pack --no-build --configuration Release Src/Senders/FluentEmailer.Mailtrap/FluentEmailer.Mailtrap.csproj --output . | |
- name: Pack FluentEmailer.SendGrid | |
run: dotnet pack --no-build --configuration Release Src/Senders/FluentEmailer.SendGrid/FluentEmailer.SendGrid.csproj --output . | |
- name: Pack FluentEmailer.Razor | |
run: dotnet pack --no-build --configuration Release Src/Renderers/FluentEmailer.Razor/FluentEmailer.Razor.csproj --output . | |
- name: Pack FluentEmailer.Liquid | |
run: dotnet pack --no-build --configuration Release Src/Renderers/FluentEmailer.Liquid/FluentEmailer.Liquid.csproj --output . | |
- name: Publish packages | |
run: dotnet nuget push *.nupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |