-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.5 KB
/
publish.yml
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
name: Build and Publish packages
on:
pull_request:
branches:
- '*'
push:
branches:
- master
env:
CI: true
jobs:
build:
# ignore commits with `[skip ci]`
if: contains(github.event.head_commit.message, '[skip ci]') != true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: 'packages/*/package-lock.json'
- run: npm ci
# Publish packages if running on main branch
- name: Configure services
if: github.ref == 'refs/heads/master'
run: |
git config --global user.email "$GIT_AUTHOR_EMAIL"
git config --global user.name "$GIT_AUTHOR_NAME"
git remote set-url origin "https://[email protected]/$GITHUB_REPOSITORY.git" > /dev/null 2>&1
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc 2> /dev/null
env:
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish packages
if: success() && (github.ref == 'refs/heads/master')
run: npx lerna publish --yes --no-verify-access
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}