Skip to content

publish

publish #22

name: Publish NuGet Package
on:
push:
branches:
- main
permissions:
contents: read # to check out code
packages: write # to push the NuGet package
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.x"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Pack
run: dotnet pack SimpleMapper/SimpleMapper/SimpleMapper.csproj \
--configuration Release \
--no-build \
--output ./artifacts
- name: Publish to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
dotnet nuget push "artifacts/*.nupkg" \
--api-key $NUGET_API_KEY \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate