publish.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Publish Terminal.Gui
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. jobs:
  7. publish:
  8. name: Build and Publish to Nuget.org
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v3
  12. with:
  13. fetch-depth: 0 #fetch-depth is needed for GitVersion
  14. - name: Install and calculate the new version with GitVersion
  15. uses: gittools/actions/gitversion/[email protected]
  16. with:
  17. versionSpec: 5.x
  18. - name: Determine Version
  19. uses: gittools/actions/gitversion/[email protected]
  20. id: gitversion # step id used as reference for output values
  21. - name: Display GitVersion outputs
  22. run: |
  23. echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
  24. echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
  25. - name: Setup dotnet
  26. uses: actions/[email protected]
  27. with:
  28. dotnet-version: 6.0.100
  29. - name: Install dependencies
  30. run: dotnet restore
  31. - name: Build Release
  32. run: |
  33. dotnet-gitversion /updateprojectfiles
  34. dotnet build --no-restore -c Release
  35. - name: Pack
  36. run: dotnet pack -c Release --include-symbols -p:Version='${{ steps.gitversion.outputs.SemVer }}'
  37. - name: Test to generate Code Coverage Report
  38. run: |
  39. dotnet test --verbosity normal --collect:"XPlat Code Coverage" --settings UnitTests/coverlet.runsettings
  40. mv -v UnitTests/TestResults/*/*.* UnitTests/TestResults/
  41. - name: Create Test Coverage Badge
  42. uses: simon-k/[email protected]
  43. id: create_coverage_badge
  44. with:
  45. label: Unit Test Coverage
  46. color: brightgreen
  47. path: UnitTests/TestResults/coverage.opencover.xml
  48. gist-filename: code-coverage.json
  49. # https://gist.github.com/migueldeicaza/90ef67a684cb71db1817921a970f8d27
  50. gist-id: 90ef67a684cb71db1817921a970f8d27
  51. gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
  52. - name: Print Code Coverage
  53. run: |
  54. echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
  55. echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
  56. #- name: Prep GitHub Packages
  57. # run: dotnet nuget add source --username tig --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/tig/index.json"
  58. #- name: Publish to GitHub packages
  59. # run: dotnet nuget push NStack/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "github"
  60. - name: Publish to NuGet.org
  61. run: dotnet nuget push Terminal.Gui/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json