publish.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. name: Publish Terminal.Gui
  2. on:
  3. push:
  4. branches: [ main, develop, v2_release, v2_develop ]
  5. tags:
  6. - v*
  7. paths-ignore:
  8. - '**.md'
  9. jobs:
  10. publish:
  11. name: Build and Publish to Nuget.org
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v3
  15. with:
  16. fetch-depth: 0 #fetch-depth is needed for GitVersion
  17. - name: Install and calculate the new version with GitVersion
  18. uses: gittools/actions/gitversion/setup@v0
  19. with:
  20. versionSpec: 5.x
  21. - name: Determine Version
  22. uses: gittools/actions/gitversion/execute@v0
  23. id: gitversion # step id used as reference for output values
  24. - name: Setup dotnet
  25. uses: actions/setup-dotnet@v3
  26. with:
  27. dotnet-version: 7.0
  28. - name: Install dependencies
  29. run: dotnet restore
  30. - name: Build Release
  31. run: |
  32. dotnet-gitversion /updateprojectfiles
  33. dotnet build --no-restore -c Release
  34. - name: Pack
  35. run: dotnet pack -c Release --include-symbols -p:Version='${{ steps.gitversion.outputs.SemVer }}'
  36. # - name: Test to generate Code Coverage Report
  37. # run: |
  38. # sed -i 's/"stopOnFail": false/"stopOnFail": true/g' UnitTests/xunit.runner.json
  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. # gist-id: 90ef67a684cb71db1817921a970f8d27
  50. # gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }}
  51. # - name: Print Code Coverage
  52. # run: |
  53. # echo "Code coverage percentage: ${{steps.create_coverage_badge.outputs.percentage}}%"
  54. # echo "Badge data: ${{steps.create_coverage_badge.outputs.badge}}"
  55. - name: Publish to NuGet.org
  56. run: dotnet nuget push Terminal.Gui/bin/Release/Terminal.Gui.${{ steps.gitversion.outputs.SemVer }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }}