xotahal / fastlane-plugin-semantic_release

Fully automated version management and generator of release notes
MIT License
213 stars 59 forks source link

Plaintext format and new options for changelogs, plus refactoring #14

Closed hanno-jonlay closed 5 years ago

hanno-jonlay commented 5 years ago

Apologies - this is a fairly large PR and includes several features - bad practice, I know πŸ™ˆ

I wanted to submit it anyway and ask for your feedback - if necessary, I can unpick changes later on (and perhaps break into separate PRs, though if possible, I'd prefer to avoid this as it will involve extra work. Let me know, anyway!

I've tested this quite a bit (and also introduced lots more tests) - I think everything works pretty well and makes the plugin a lot more adaptable and powerful. But that's a biased opinion 🀣. I'd love it if you would consider merging these.

Here's a summary of the main changes...

Refactoring of changelog generation + new format: 'plain' formatting option. Here's how this looks:

I added a new format: 'plain' option. This was designed to generate the changelog in a format that works nicely with TestFlight (which doesn't support markdown). Here's how the output looks for this:

1.5.1 (2019-11-10)

Features:
- new display_title parameter to hide the header in changelog (https://github.com/abc123)

Bug fixes:
- clean up text strings (https://github.com/abc123)

There are now 3 different options that can be passed into the plugin for formatting:

While it arguably make more sense for plain to be the default, I didn't want this to be a breaking change, so I've left markdown as the default.

There were 2 large self.markdown and self.slack chunks inside conventional_changelog.rb. As I think you know, these had a lot of duplicated code. I refactored both of them so that all 3 of the format options can use the same logic to generate the changelog. This all lives inside a note_builder method.

As part of this, I created a style_text method which should be extensible in the future, if we wanted to add extra formatting options (e.g. a html option).

Addition of new display_title option for changelog

In some situations, it doesn't make sense to have the version number and title placed at the top of the changelog. That's the case in TestFlight, and also in GitHub. For example, here's how the GH releases page looks for this repo, with the duplicated titles:

image

I've left the defaults unchanged, but I did introduce a new display_title option. Defaults to true.

If this is set to false, it will remove the title (and newlines) from the top of the changelog. So the output will look a little like this (in plain text mode):

Features:
- new display_title parameter to hide the header in changelog (https://github.com/abc123)

Bug fixes:
- clean up text strings (https://github.com/abc123)

Addition of new display_links option for changelog

Sometimes it doesn't make sense to include the links to the git commits inside the prepared changelog (e.g. in a context which doesn't support them, like TestFlight changelogs).

I've left the defaults unchanged, but I did introduce a new display_links option. Defaults to true.

If this is set to false, it will remove the links from changelog entries. So the output will look a little like this (in plain text mode):

Features:
- new display_title parameter to hide the header in changelog

Bug fixes:
- clean up text strings

Other refactoring

xotahal commented 5 years ago

Nicely done! πŸ‘ Thank you for that!

hanno-jonlay commented 5 years ago

πŸ™Œ thanks, my man!