Updated GitHub Actions versions #3
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 to NuGet | |
on: | |
workflow_dispatch: # Allow running the workflow manually from the GitHub UI | |
push: | |
branches: | |
- 'main' # Run the workflow when pushing to the main branch | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
NuGetDirectory: ${{ github.workspace}}/.nuget | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build solution | |
run: dotnet build --configuration Release --no-restore | |
- name: Run tests | |
run: dotnet test --no-restore | |
- name: Create NuGet package | |
run: dotnet pack --configuration Release --no-restore --output ${{ env.NuGetDirectory }} | |
- name: Publish NuGet package | |
run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --api-key ${{ secrets.NUGET_APIKEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |