Skip to content

Commit 24cb3a5

Browse files
Automate release notes and version from GitHub releases (#433)
* Automate release notes and version from GitHub releases - Extract version from release tag, handling 'v' prefix - Use release body as PackageReleaseNotes - Pass values to dotnet pack via MSBuild properties - Remove hardcoded Version and PackageReleaseNotes from csproj Co-Authored-By: Martin <m@martinnormark.com> * Fix PackageReleaseNotes handling for quotes and newlines - Write release notes to file first to avoid shell escaping issues - Read from file using cat to safely handle quotes and line breaks - Addresses feedback from @martinnormark on PR #433 Co-Authored-By: Martin <m@martinnormark.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Martin <m@martinnormark.com>
1 parent 73e3b31 commit 24cb3a5

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,26 @@ jobs:
2828
working-directory: ./PreMailer.Net
2929
run: dotnet test --no-restore --verbosity normal --collect "Code coverage"
3030

31+
- name: Extract version from tag
32+
if: ${{ github.event_name == 'release' }}
33+
id: version
34+
run: |
35+
TAG_NAME="${{ github.event.release.tag_name }}"
36+
VERSION=${TAG_NAME#v}
37+
echo "version=$VERSION" >> $GITHUB_OUTPUT
38+
39+
- name: Write release notes to file
40+
if: ${{ github.event_name == 'release' }}
41+
run: echo "${{ github.event.release.body }}" > release-notes.txt
42+
3143
- name: Package
3244
if: ${{ github.event_name == 'release' }}
33-
run: dotnet pack -c Release -o . PreMailer.Net/PreMailer.Net/PreMailer.Net.csproj
45+
run: |
46+
RELEASE_NOTES=$(cat release-notes.txt)
47+
dotnet pack -c Release -o . PreMailer.Net/PreMailer.Net/PreMailer.Net.csproj \
48+
-p:Version="${{ steps.version.outputs.version }}" \
49+
-p:PackageReleaseNotes="$RELEASE_NOTES"
50+
3451
- name: Publish
3552
if: ${{ github.event_name == 'release' }}
3653
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_APIKEY }} -s https://api.nuget.org/v3/index.json

PreMailer.Net/PreMailer.Net/PreMailer.Net.csproj

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
6-
<Version>2.7.0</Version>
76
<Authors>Martin H. Normark</Authors>
87
<Description>
98
PreMailer.Net is a C# utility for moving CSS to inline style attributes, to gain maximum E-mail client compatibility.
@@ -14,30 +13,6 @@
1413
<PackageIcon>icon.png</PackageIcon>
1514
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1615
<PackageReadmeFile>README.md</PackageReadmeFile>
17-
<PackageReleaseNotes>
18-
What's Changed
19-
20-
* Build(deps): Bump actions/checkout from 4.1.6 to 4.1.7 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/409
21-
* Build(deps): Bump actions/setup-dotnet from 4.0.0 to 4.0.1 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/411
22-
* Build(deps): Bump pascalgn/automerge-action from 0.16.3 to 0.16.4 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/412
23-
* Build(deps): Bump actions/checkout from 4.1.7 to 4.2.0 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/413
24-
* Build(deps): Bump actions/checkout from 4.2.0 to 4.2.1 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/414
25-
* Build(deps): Bump actions/checkout from 4.2.1 to 4.2.2 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/415
26-
* Build(deps): Bump actions/setup-dotnet from 4.0.1 to 4.1.0 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/416
27-
* Build(deps): Bump actions/setup-dotnet from 4.1.0 to 4.2.0 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/418
28-
* Update target frameworks of test and benchmark projects by @martinnormark in https://github.com/milkshakesoftware/PreMailer.Net/pull/420
29-
* LinkTagCssSource now also downloads content from @import declarations. by @whorchner in https://github.com/milkshakesoftware/PreMailer.Net/pull/419
30-
* Build(deps): Bump actions/setup-dotnet from 4.2.0 to 4.3.0 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/421
31-
* Build(deps): Bump actions/setup-dotnet from 4.3.0 to 4.3.1 by @dependabot in https://github.com/milkshakesoftware/PreMailer.Net/pull/423
32-
* Fix #410: Preserve !important tag in inlined styles by @devin-ai-integration in https://github.com/milkshakesoftware/PreMailer.Net/pull/424
33-
* Fix #347: Preserve HTML entities like &amp;copy; during processing by @devin-ai-integration in https://github.com/milkshakesoftware/PreMailer.Net/pull/425
34-
* Update README to accurately document PreMailer API by @devin-ai-integration in https://github.com/milkshakesoftware/PreMailer.Net/pull/426
35-
* Fix #171: Preserve empty HTML tags during serialization by @devin-ai-integration in https://github.com/milkshakesoftware/PreMailer.Net/pull/427
36-
* Fix CSS comment regex to handle protocol-agnostic URLs in premailer attributes by @devin-ai-integration in https://github.com/milkshakesoftware/PreMailer.Net/pull/428
37-
* Fix issue #235: Preserve base64 encoded images and URLs during CSS parsing and style application by @devin-ai-integration in https://github.com/milkshakesoftware/PreMailer.Net/pull/429
38-
39-
Full Changelog: https://github.com/milkshakesoftware/PreMailer.Net/compare/v2.6.0...v2.7.0
40-
</PackageReleaseNotes>
4116
<PackageTags>email css newsletter html</PackageTags>
4217
<SignAssembly>true</SignAssembly>
4318
<AssemblyOriginatorKeyFile>PreMailer.Net.snk</AssemblyOriginatorKeyFile>

0 commit comments

Comments
 (0)