2323 name : Run tests and create NuGet package
2424 outputs :
2525 coverage-reports : ${{ steps.dotnet-test.outputs.coverage-reports }}
26- version : ${{ steps.dotnet-pack.outputs.version }}
2726 nupkg-filename : ${{ steps.dotnet-pack.outputs.nupkg-filename }}
28- release-body : ${{ steps.tag-message.outputs.release-notes }}
2927 steps :
3028 - name : Checkout git repository
3129 uses : actions/checkout@v3
@@ -95,16 +93,17 @@ jobs:
9593 run : |
9694 dotnet tool restore
9795 dotnet tool run dotnet-stryker --reporter dashboard --version ${GITHUB_REF_NAME} --dashboard-api-key ${{ env.STRYKER_DASHBOARD_API_KEY }}
98- - name : Retrieve tag message
99- if : matrix.os == 'ubuntu-latest'
96+ - name : Retrieve release notes from tag
97+ if : matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
10098 run : |
10199 git fetch --tags --force
102- RELEASE_NOTES=$(git tag --list ${{ steps.dotnet-pack.outputs.version }} --format='%(contents)')
103- RELEASE_NOTES="${RELEASE_NOTES//'%'/%25}"
104- RELEASE_NOTES="${RELEASE_NOTES//$'\n'/%0A}"
105- RELEASE_NOTES="${RELEASE_NOTES//$'\r'/%0D}"
106- echo "release-notes=$RELEASE_NOTES" >> $GITHUB_OUTPUT
107- id : tag-message
100+ git tag --list ${{ github.ref_name }} --format='%(contents)' > ReleaseNotes.md
101+ - name : Upload release notes
102+ if : matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/')
103+ uses : actions/upload-artifact@v3
104+ with :
105+ name : Release Notes
106+ path : ReleaseNotes.md
108107 publish :
109108 runs-on : macos-latest
110109 needs : package
@@ -117,12 +116,15 @@ jobs:
117116 uses : actions/download-artifact@v3
118117 with :
119118 name : ${{ needs.package.outputs.nupkg-filename }}
119+ - name : Download release notes artifact
120+ uses : actions/download-artifact@v3
121+ with :
122+ name : Release Notes
120123 - name : Create GitHub Release
121124 uses : softprops/action-gh-release@v1
122125 with :
123- name : Version ${{ needs.package.outputs.version }}
124- tag_name : ${{ needs.package.outputs.version }}
125- body : ${{ needs.package.outputs.release-body }}
126- prerelease : ${{ contains(needs.package.outputs.version, '-') }}
126+ name : Version ${{ github.ref_name }}
127+ body_path : ReleaseNotes.md
128+ prerelease : ${{ contains(github.ref_name, '-') }}
127129 - name : Publish NuGet package on nuget.org
128130 run : dotnet nuget push ${{ needs.package.outputs.nupkg-filename }} --source https://api.nuget.org/v3/index.json --api-key "${{ secrets.NUGET_API_KEY }}"
0 commit comments