openedx / wg-frontend

Open edX Frontend Working Group
4 stars 0 forks source link

Shared Github Action workflow for `semantic-release` dry-run to preview next version on PRs #139

Open adamstankiewicz opened 1 year ago

adamstankiewicz commented 1 year ago

Most of our JS repos use semantic-release to release to NPM, which handles semantic versioning based on commit types. While the rest of the non-JS repos have also conformed to standard commit types (e.g., feat, fix, etc.), only a small subset of commit types will actually trigger a release to NPM:

Any other commit types (e.g., chore) does not trigger an NPM release with the default semantic-release configuration. This makes sense, though, as not every commit should trigger a release.

That said, it would be helpful for our JS repos to have a way to indicate to engineers who author/review PRs which version, if any, will be released by semantic-release based on the commit type(s) used in the branch. This would give an extra sanity check to ensure merging a PR will have the intended outcome regarding NPM releases.

Some repos have attempted to include a step in their CI workflows to output the results from a dry-run of semantic-release.

  1. Working example in frontend-enterprise (source), though this is a monorepo managed by Lerna, which uses semantic-release behind-the-scenes.
  2. Non-working example in paragon (source), using vanilla semantic-release. Results in the following error: This run was triggered by a pull request and therefore a new version won't be published.

AC

ishahroz commented 1 year ago

Following are some of the observations I came across while working on this issue:

Verdict: While these un-official options exist, an official support with proper inputs and outputs would be even more appreciated. Plus, official support is highly likely to be most regularly maintained by open-source community (lesser chances of bugs and improved security as well). For now, we can stick one of 2 above-discussed options. Looking forward to discuss it more.

cc: @adamstankiewicz

adamstankiewicz commented 1 year ago

@ishahroz Great investigation! An officially supported solution to this problem seems like its desired by the community; it'd be fantastic if there was an official solution. The primary goal of this is to help PR authors aware of the next version to be released, not so much previewing release notes, etc. I'd say the release notes preview specifically is a nice-to-have, where only the next version to be released is a must.

It seems that the last suggestion could be worth exploring to see if we could get it to work. Should we try enabling it in Paragon and/or any other repos? I'm not too concerned around the creating/updating comments on the PR with this solution because I believe we have some prior art for how to manage such behavior.

arbrandes commented 1 year ago

+1 for semantic-release-export-data!

@ishahroz, have you been able to test it already?

arbrandes commented 1 year ago

@abdullahwaheed, checking status: it looks like this was set to blocked. Care to give us a short update? What is this blocked on?

Mashal-m commented 1 year ago

Hey, I have explored this package, but there's no luck when it comes to triggering dry runs within PR. I have asked the owner of this package, and here is what he replied. Other than that I have implemented this package in my personal project built from scratch, but dry run is not running there as well => PR

arbrandes commented 1 year ago

It seems like semantic-release-export-data won't do the job, then. Thanks for looking into it, @Mashal-m.

Any objections to following this particular suggestion (the one based on @semantic-release/exec)? I feel like I've seen somebody try this in a repo, but I forget which one.

Mashal-m commented 11 months ago

feat: config semantic release work around openedx/frontend-component-header#341

Hey @arbrandes, I have tried this suggestion as well, but it is not helping either. You can have a look at PR.

arbrandes commented 3 months ago

@Mashal-m, have there been any findings since last August? Do we want to continue pursuing this?