-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (80 loc) · 3.1 KB
/
deploy.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
- name: Build Brand Assets
run: npm run build:brand
- name: Build Styles
run: npm run build:styles
- name: Test
run: npm run test
# Rebuild components as the `test` command builds Components in `dev` mode
- name: Build Components
run: npm run build:components
- name: Build storybook
run: npm run storybook:build -- --quiet
# Publish storybook to Chromatic https://www.chromatic.com/
- name: Publish Storybook to Chromatic
# Don’t send package update PRs to Chromatic
if: success() && startsWith(github.head_ref, 'renovate/dev') != true
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: docs
exitOnceUploaded: true
# Publish packages if running on main branch
- name: Configure services
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 }}
# Verify that NPM authentication succeeded, try to prevent failed releases
# @see https://github.com/lerna/lerna/issues/2788#issuecomment-774265338
- name: Check NPM authentication
if: success() && (github.ref == 'refs/heads/master')
run: npm whoami
- name: Publish package
# @see https://github.com/lerna/lerna/issues/2788#issuecomment-7742653388
run: npx lerna publish --yes --no-verify-access
if: success() && (github.ref == 'refs/heads/master')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Deploy Storybook to Github Pages
- name: Deploy to GitHub Pages
if: success() && (github.ref == 'refs/heads/master')
uses: crazy-max/ghaction-github-pages@v2
with:
build_dir: docs
committer: ${{ secrets.GIT_AUTHOR_NAME }} <${{ secrets.GIT_AUTHOR_EMAIL }}>
author: ${{ secrets.GIT_AUTHOR_NAME }} <${{ secrets.GIT_AUTHOR_EMAIL }}>
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}