Skip to content

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

@adamstankiewicz

Description

@adamstankiewicz

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:

  • fix
  • feat
  • perf

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

  • Add new Github Action workflow file to https://github.com/openedx/.github/blob/master/workflow-templates/ to run a dry-run of semantic-release to preview what version (if any) would be released after merging a given PR.
  • Ideally, this workflow could add/update a comment to the PR with what version (if any) would be released upon merge based on the PRs commits.
  • Enable the CI workflow on JS repos that release via semantic-release (intentionally not include frontend-enterprise here because it uses Lerna and has a working solution already). Sampling of repos:
    • @edx/frontend-build
    • @edx/frontend-platform
    • @edx/paragon
    • @edx/browserslist-config
    • @edx/frontend-component-header
    • @edx/frontend-component-header-edx
    • @edx/frontend-component-footer
    • @edx/frontend-component-footer-edx

Metadata

Metadata

Labels

enhancementRelates to new features or improvements to existing features

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions