-
Notifications
You must be signed in to change notification settings - Fork 262
124 lines (107 loc) · 4.21 KB
/
ci-pr.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Deploy PR previews
concurrency: preview-${{ github.ref }}
on:
pull_request:
types:
- opened
- reopened
- synchronize
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "16.19.0"
- name: Install Dependencies
run: yarn
- name: Filter the packages
uses: dorny/paths-filter@v3
id: changes
with:
filters: |
react:
- 'packages/react/**'
ui-elements:
- 'packages/ui-elements/**'
layout_editor:
- 'packages/layout_editor/**'
docs:
- 'packages/docs/**'
- name: Create Build Directory
run: |
mkdir -p build/
mkdir -p build/pulls
mkdir -p build/pulls/pr-${{github.event.number}}
- name: Build Storybook
if: steps.changes.outputs.react == 'true' && github.event.action != 'closed'
run: yarn build:storybook
working-directory: packages/react
- name: Prepare Build for Storybook
if: steps.changes.outputs.react == 'true' && github.event.action != 'closed'
run: mv -v packages/react/storybook-static/* build/pulls/pr-${{github.event.number}}/
- name: Build UI-Elements
if: steps.changes.outputs.ui-elements == 'true' && github.event.action != 'closed'
run: yarn build:storybook
working-directory: packages/ui-elements
- name: Prepare Build for UI-Elements
if: steps.changes.outputs.ui-elements == 'true' && github.event.action != 'closed'
run: |
if [ -z "$(ls -A build/pulls/pr-${{github.event.number}})/" ]; then
mv -v packages/ui-elements/storybook-static/* build/pulls/pr-${{github.event.number}}/
else
mkdir -p build/ui-elements
mv -v packages/ui-elements/storybook-static/* build/pulls/pr-${{github.event.number}}/ui-elements/
fi
- name: Build Layout Editor
if: steps.changes.outputs.layout_editor == 'true' && github.event.action != 'closed'
env:
BASE_URL: "EmbeddedChat/pulls/pr-${{github.event.number}}/"
run: yarn build
working-directory: packages/layout_editor
- name: Prepare build for Layout_editor
if: steps.changes.outputs.layout_editor == 'true' && github.event.action != 'closed'
run: |
if [ -z "$(ls -A build/pulls/pr-${{github.event.number}})" ]; then
mv -v packages/layout_editor/dist/* build/pulls/pr-${{github.event.number}}/
else
mkdir -p build/layout_editor
mv -v packages/layout_editor/dist/* build/pulls/pr-${{github.event.number}}/layout_editor/
fi
- name: Setup Node.js for Docs
if: steps.changes.outputs.docs == 'true' && github.event.action != 'closed'
uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: "Install dependencies for docs"
if: steps.changes.outputs.docs == 'true' && github.event.action != 'closed'
run: yarn install
working-directory: packages/docs/
- name: Build Docs
if: steps.changes.outputs.docs == 'true' && github.event.action != 'closed'
env:
BASEURL: "EmbeddedChat/pulls/pr-${{github.event.number}}/"
run: yarn build
working-directory: packages/docs
- name: Prepare build for Docs
if: steps.changes.outputs.docs == 'true' && github.event.action != 'closed'
run: |
if [ -z "$(ls -A build/pulls/pr-${{github.event.number}})" ]; then
mv -v packages/docs/build/* build/pulls/pr-${{github.event.number}}/
else
mkdir -p build/docs
mv -v packages/docs/build/* build/pulls/pr-${{github.event.number}}/docs/
fi
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-deploy
build_dir: build/
commit_message: "Deploy to Github Pages"
jekyll: false
keep_history: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}