Introduce a way to automatically clean up old releases

We use the Balena GitHub Action to automatically build releases for all our PRs and merges. This causes us to very quickly accumulate a lot of releases across our fleets.
It would be nice to have releases from PRs automatically deleted once they have been merged (or closed).
Automatically removing older releases based on certain rules, would be a great extra tool to keep the amount of releases in check.
Let’s say we want to keep the latest 2 patches, 1 minor and 1 major release, assuming the latest release is 5.6.11 then we would keep 5.6.10, 5.5.12 and 4.17.3 .