WelcomePrivate Registry🔒 Code Challenge
Boilerplates
Code Linting
Github Actions
Styled
🔒 Local Setup
🔒 Server Setup
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 yourpackage.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: Releaseon:push:branches:- mainpaths-ignore:- '**.md'- '**.mdx'jobs:release:name: Releaseruns-on: ubuntu-lateststeps:- name: Configure CI Git Userrun: |git config --global user.email wild-bot@github.comgit config --global user.name GitHub Actions- name: Checkoutuses: actions/checkout@v2with:fetch-depth: 0- uses: actions/setup-node@v2with:node-version: '14'- run: echo //registry.wild.plus/:_authToken=${{ secrets.NPM_TOKEN }} > .npmrc- run: yarn install- run: yarn releaseenv:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- Create a secret clicking on Settings > Secrets > New Repository Secrets:
Name | Value |
---|---|
NPM_TOKEN | Search 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 theno-verify-access
flag (read here why):{..."scripts": {..."release": "lerna publish --yes --no-verify-access"}} - Drop the
commands.publish.registry
field inlerna.json
- Replace
registry.wild.plus
asregistry.npmjs.org
in.github/workflows/action.yml
- Search
NPM wild user
on 1Password and replace the NPM_TOKEN value.