Automate release notes and version from GitHub releases #433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Automate release notes and version from GitHub releases
Summary
This PR eliminates the need to manually maintain version numbers and release notes in the csproj file by automating them through GitHub releases. When a new release is created on GitHub, the workflow will now:
dotnet packvia MSBuild propertiesThe hardcoded
VersionandPackageReleaseNotesproperties have been removed from the csproj file, making the release process much more streamlined.Key Changes:
github.event.release.tag_namecatdotnet packcommand to use MSBuild properties-p:Versionand-p:PackageReleaseNotesReview & Testing Checklist for Human
dotnet buildanddotnet packcommands still work (they should use default version 1.0.0 without the properties)Diagram
graph TD A[GitHub Release Created] --> B[dotnetcore.yml Workflow] B --> C[Extract Version Step] B --> D[Write Release Notes Step] B --> E[Package Step] B --> F[Publish Step] C --> G[github.event.release.tag_name] C --> H[Strip v prefix] C --> I[Output version variable] D --> J[github.event.release.body] D --> K[Write to release-notes.txt] K --> E I --> E E --> L[Read from file with cat] E --> M[dotnet pack with MSBuild props] N[PreMailer.Net.csproj] --> E style B fill:#90EE90 style N fill:#90EE90 style C fill:#87CEEB style D fill:#87CEEB style E fill:#87CEEB style F fill:#white style A fill:#white style G fill:#white style H fill:#white style I fill:#white style J fill:#white style K fill:#white style L fill:#white style M fill:#white subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#whiteNotes
release-notes.txtfirst, then read withcatto safely handle quotes, newlines, and other special characters that could break shell command parsinggithub.event_name == 'release', so they won't affect regular PR builds