Merge pull request #78 from rprouse/issue/52 #33
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
name: .NET Core Build Test and Publish | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: π₯ Checkout Code | |
uses: actions/checkout@v3 | |
- name: π Install dependencies | |
run: dotnet restore | |
- name: π οΈ Build | |
run: dotnet build --configuration Release --no-restore | |
- name: β Test | |
run: dotnet test --no-restore --verbosity normal | |
- name: π¦ Package NuGet | |
run: dotnet pack --no-build --configuration Release src/todo/todo.csproj | |
- name: π€ Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nupkg | |
path: src/todo/nupkg/*.nupkg | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
# only push nuget package for PRs merged to master | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: π₯ Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
- name: π Authenticate to GitHub Packages | |
run: dotnet nuget add source --username rprouse --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/rprouse/index.json" | |
- name: π€ Publish NuGet to GitHub Packages | |
run: dotnet nuget push "**/dotnet-todo.*.nupkg" -k ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate --no-symbols |