Skip to content

Commit

Permalink
Merge pull request #53 from anenviousguest/fix/52-generate-changelog
Browse files Browse the repository at this point in the history
Fixes #52: added support for automatically generated release notes.
  • Loading branch information
jutzig committed Dec 4, 2023
2 parents 92b5084 + 95ce24a commit d9430d9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ Additional Parameters:

The plugin is available on Maven central

## Note on release description
The easiest way of getting a good release description (aka release notes or changelog) is to defer its generation to the GitHub. So if you completely leave out
the `<description>` configuration parameter, then GitHub will generate a meaningful description for you. Otherwise, if description _is_ supplied, it will be
prepended to one generated by GitHub.

Below is an example of how the auto-generated release notes by GitHub could look like:

<img src="https://github.com/jutzig/github-release-plugin/assets/8439575/4e9479a5-a93d-420f-8153-06ad74ab48b7" width="500" alt="Screenshot of autogenerated GitHub release notes" />

You can read how to customize release notes format in [GitHub documentation][github-release-notes-format].

## Note on the GitHub API endpoints
The endpoint for GitHub API is inferred from `<scm>` connection string. When missing, it by default would use the public endpoint at https://api.github.com.
If you want to upload to a GitHub enterprise instance, then a respective `<scm>` connection string must be specified.

<!-- Links, sorted alphabetically -->
[github-release-notes-format]: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.317</version>
<version>1.318</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class UploadMojo extends AbstractMojo implements Contextualizable{
/**
* The release description
*/
@Parameter(property = "project.description")
@Parameter
private String description;

/**
Expand Down Expand Up @@ -189,6 +189,7 @@ public void execute() throws MojoExecutionException {
if (release == null) {
getLog().info("Creating release "+releaseName);
GHReleaseBuilder builder = repository.createRelease(tag);
builder.generateReleaseNotes(true);
if(description!=null) {
builder.body(description);
}
Expand Down

0 comments on commit d9430d9

Please sign in to comment.