-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (60 loc) · 1.87 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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