for developers
Welcome
Boilerplates
Code Linting
Github Actions
Getting StartedLerna ReleaseBehaviorInstallationPublish under registry.npmjs.orgPull Request Changelog GeneratorSemantic Release
Private Registry
Styled
🔒  Local Setup
🔒  Server Setup
🔒  Code Challenge

Lerna Release

A Github Action for release monorepo packages under registry.wild.plus.

Behavior

On every push on the main branch:

  • Packages that have changes will be published under registry.wild.plus.
  • Based on the commit history, a changelog will be generated on each package folder.
  • A Github release will be created for each published package.

Installation

  • Install lerna, launching yarn add lerna -D -W from the root of the repository
  • Create a new release script in your package.json:
{
...
"scripts": {
...
"release": "lerna publish --yes"
}
}
  • Then add this to a lerna.json file:
{
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/*"
],
"command": {
"version": {
"ignoreChanges": [
"*.md",
"*.mdx"
],
"message": "chore(release): [skip ci]"
},
"publish": {
"conventionalCommits": true,
"createRelease": "github",
"registry": "https://registry.wild.plus/"
}
}
}
  • Then add this to a .github/workflows/action.yml file:
name: Release
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- '**.mdx'
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Configure CI Git User
run: |
git config --global user.email wild-bot@github.com
git config --global user.name GitHub Actions
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '14'
- run: echo //registry.wild.plus/:_authToken=${{ secrets.NPM_TOKEN }} > .npmrc
- run: yarn install
- run: yarn release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  • Create a secret clicking on Settings > Secrets > New Repository Secrets:
NameValue
NPM_TOKENSearch registry.wild.plus on 1Password

Publish under registry.npmjs.org

In some cases, you might need to publish directly under registry.npmjs.org.
Be sure to follow these steps:

  • Change the release script adding the no-verify-access flag (read here why):
    {
    ...
    "scripts": {
    ...
    "release": "lerna publish --yes --no-verify-access"
    }
    }
  • Drop the commands.publish.registry field in lerna.json
  • Replace registry.wild.plus as registry.npmjs.org in .github/workflows/action.yml
  • Search NPM wild user on 1Password and replace the NPM_TOKEN value.