23
23
name : Run tests and create NuGet package
24
24
outputs :
25
25
coverage-reports : ${{ steps.dotnet-test.outputs.coverage-reports }}
26
- version : ${{ steps.dotnet-pack.outputs.version }}
27
26
nupkg-filename : ${{ steps.dotnet-pack.outputs.nupkg-filename }}
28
- release-body : ${{ steps.tag-message.outputs.release-notes }}
29
27
steps :
30
28
- name : Checkout git repository
31
29
uses : actions/checkout@v3
@@ -95,16 +93,17 @@ jobs:
95
93
run : |
96
94
dotnet tool restore
97
95
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/')
100
98
run : |
101
99
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
108
107
publish :
109
108
runs-on : macos-latest
110
109
needs : package
@@ -117,12 +116,15 @@ jobs:
117
116
uses : actions/download-artifact@v3
118
117
with :
119
118
name : ${{ needs.package.outputs.nupkg-filename }}
119
+ - name : Download release notes artifact
120
+ uses : actions/download-artifact@v3
121
+ with :
122
+ name : Release Notes
120
123
- name : Create GitHub Release
121
124
uses : softprops/action-gh-release@v1
122
125
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, '-') }}
127
129
- name : Publish NuGet package on nuget.org
128
130
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