chore(actions): document issues with lerna and checkout #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
# https://dev.to/xcanchal/automatic-versioning-in-a-lerna-monorepo-using-github-actions-4hij | |
# Problems: | |
# I tried to use github registry to publish public packages, | |
# but packages in github require auth to install even if package is public. | |
# | |
# Npm token will not be configured without registry-url set in actions/setup-node | |
# To configure authToken for npm both registry-url and secret is needed. | |
# When publishing public package, publishConfig.access need to be configured on each package | |
# | |
# Lerna need fetch-depth: 0 (full fetch) on checkout to be able generate full changelog | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
publish: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Setup NodeJS 22" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Install | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- name: Test | |
run: yarn test | |
- name: Lint | |
run: yarn lint | |
- name: Setup git user | |
run: | | |
echo "Setup git user to github action user" | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor}}@users.noreply.github.com" | |
- name: "Version and publish" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Version" | |
yarn lerna version \ | |
--conventional-commits \ | |
--yes | |
echo "Publish" | |
yarn lerna publish from-git \ | |
--loglevel debug \ | |
--yes |