Shared github action for automated package publishing in lerna monorepos
This Dockerized action is using Node v12
Checks your commit messages and
- If it detects the text
BREAKING CHANGE
it publishes a MAJOR version - Otherwise it publishes a PATCH or MINOR version following the conventional commits format
-
Your project should be a lerna monorepo
-
In case you have configured an "allowBranch" in your
lerna.json
make sure that the action ONLY runs in that branch -
In your action make sure to configure the env variable of
PRIVATE_REPO_PAT
The following config assumes that
- The branch used for publishing is the
main
- Only runs for the
push
event - Runs only if a change in the
packages
folder has been made
name: Publish
on:
push:
branches:
- main
paths:
- 'packages/**'
jobs:
publish-lerna-packages:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]
with:
# pulls all commits (needed for lerna / semantic release to correctly version)
fetch-depth: "0"
- name: Publish 🚀
uses: LoveToKnow/ltk-publish-lerna-action@main
env:
PRIVATE_REPO_PAT: ${{ secrets.PRIVATE_REPO_PAT }}