github icon indicating copy to clipboard operation
github copied to clipboard

Re-Tag pre-release correctly on production as latest release

Open josias-r opened this issue 1 year ago • 3 comments

Hi!

I'm not sure what the thought process behind the current behaviour is, but for me I'm not sure why a master release to an existing pre-release won't mark the release on github as the latest release.

Semantic-release for NPM has that behaviour as I would expect.

To clarify what I mean:

  1. Use this simple releaserc config (and this GH action)
  2. Push a release-relevant commit to the next branch
  3. Release CI will run and correctly publish a:
    • x.x.x@next NPM package Screenshot 2023-03-21 at 13 25 47
    • x.x.x GitHub release tagged as pre-release Screenshot 2023-03-21 at 13 24 09
  4. Merge the next branch into master
  5. Release CI will tag the existing x.x.x@next NPM package with @latest Screenshot 2023-03-21 at 13 28 05

But the GitHub release, will NOT be tagged as latest-release.

I would expect for the GitHub release to also be tagged similar to NPM.

josias-r avatar Mar 21 '23 12:03 josias-r

Same issue here, did you find a solution?

JasonLandbridge avatar May 28 '23 10:05 JasonLandbridge

I remember that there was a reason why we couldn't do this in the past, maybe an API was missing or not working correctly. If you could look into it and test if you can mark a pre-release on github as latest, that would be a great start. Once we verified that it's possible, we can work on a pull request to add that functionality

gr2m avatar May 28 '23 16:05 gr2m

It looks like this feature is now available in the API. I ran a pre-release image

then merged to my primary release branch, this removed the pre-release status from the branch. image

I think this should mean that per the github api, this can now be marked as latest per the make_latest argument since it's no longer a pre-release. https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28

Specifies whether this release should be set as the latest release for the repository. Drafts and prereleases cannot be set as latest. Defaults to true for newly published releases. legacy specifies that the latest release should be determined based on the release creation date and higher semantic version.

brenden-ef avatar Jul 07 '23 15:07 brenden-ef