feat: Add GitHub Actions workflow for automated npm publishing#13
feat: Add GitHub Actions workflow for automated npm publishing#13
Conversation
…rsion bump handling
…s and publishing process
acd76b5 to
8f7ab82
Compare
|
Looking good. Just one question, on the release branches, is there any protection in case we are in the wrong branch and push a commit? |
It will have to go through a PR ultimately for main. For the release branches we can setup a rule to prevent direct merges: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/managing-a-branch-protection-rule |
We'll add branch protection on those branches. That won't sit in this workflow though, just in the repo settings. |
…uding dynamic workflow path determination, version bump validation, and npm publishing logic
…words from MINOR/MAJOR to #minor/#major
…proved compatibility
…test' to 'beta' for main branch publishing
|



Description
This PR introduces enhancements to our GitHub Actions publishing workflow (
publish.yml) to support:release/v1,release/v2, etc.) with dedicated npm dist-tags.Why are we doing this?
We want to:
What's changing?
1. Automatic Patch Versioning for Regular Code Changes
When PRs with file changes are merged to
mainor a release branch:2. Semantic Versioning via Empty Commits
We can explicitly control the type of version bump by creating an empty commit with the keywords
#minoror#major:1.0.0→1.0.1)#minor: Minor (1.0.0→1.1.0)#major: Major (1.0.0→2.0.0)E.g:
3. Major-Version Release Branches
We can now support long-lived release branches for each major version:
release/v1,release/v2, etc.latesttag.Example:
mainbranch publishes aslatest(e.g.,3.0.0,3.1.0, etc.)release/v2branch publishes as2x(e.g.,2.0.0,2.0.1,2.1.0, etc.)4. Manual Workflow Trigger
We've added a manual workflow trigger with configurable options:
beta. You don't have to specific a tag if it's a release branch as it will pick it up from there.trueby default.This allows for special publishing scenarios like beta releases, or when we need to publish outside the normal merge process.
How does this workflow trigger?
The workflow runs in three ways:
1. Standard Development Flow (File Changes)
When PR is merged to main:
Example:
mainbetatagnpm install @defra/forms-engine-plugin2. Backporting to Release Branches
Cherry-pick commits to release branches:
Example:
main(version 3.0.0)release/v2to support users of the plugin that are using one of the stable release branches:git checkout release/v2 git cherry-pick abc123def # Commit hash from main git push origin release/v22xtagnpm install @defra/forms-engine-plugin@2x3. Version Bumps via Empty Commits
Minor version bump on release branch:
Example:
release/v2after several patchesgit checkout release/v2 git commit --allow-empty -m "release: #minor version bump" git push origin release/v22xtagMajor version bump on main:
Example:
main(currently at 3.x.x)git checkout main git commit --allow-empty -m "release: #major version for breaking changes" git push origin mainbetatag4. Special Releases via Manual Workflow
Beta release from feature branch:
Example:
betatagnpm install @defra/forms-engine-plugin@beta