-
Notifications
You must be signed in to change notification settings - Fork 83
73 lines (62 loc) · 2.46 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Publish
on:
push:
branches:
- main
jobs:
publish:
name: Build and publish npm packages with lerna
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
ref: 'main'
# Use personnel access token for bot account
token: ${{ secrets.GH_USER_PAT }}
- name: git config user
run: |
git config user.email "[email protected]"
git config user.name "sb1-designsystem"
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.com'
- run: |
npm install
echo "$GITHUB_WORKSPACE/node_modules/.bin/" >> $GITHUB_PATH
- name: lerna changed
id: lerna-changed
run: echo "CHANGED_COUNT=$(lerna changed|wc -l)" >> $GITHUB_OUTPUT
- name: Build packages
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: |
npm run build
npm run lint
npm test -- --ci
- name: lerna publish to registry.npmjs.com
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: lerna publish --yes --no-verify-access --force-git-tag --create-release github
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GH_USER_PAT }}
- name: Merge back changes to development branch
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: |
git checkout develop
git pull
git merge -X theirs --no-edit main
git push origin develop
git push --tags
- name: Build storybook
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
run: |
npm run build
npm run build-storybook
- name: Deploy storybook as gh-pages
if: ${{ steps.lerna-changed.outputs.CHANGED_COUNT > 0 }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: storybook-static
branch: gh-pages
token: ${{ secrets.GH_USER_PAT }}