publish #22
This file contains hidden or 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
| 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 |