-
Notifications
You must be signed in to change notification settings - Fork 161
147 lines (137 loc) · 4.42 KB
/
cd.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Continuous Delivery
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
outputs:
branch-name: ${{ steps.set-branch-name.outputs.branch-name }}
steps:
- uses: actions/setup-node@v2
with:
node-version: "14.21.3"
- uses: actions/checkout@v2
- name: Turbo Cache
id: turbo-cache
uses: actions/cache@v2
with:
path: .turbo
key: turbo-${{ runner.os }}-${{ github.job }}
restore-keys: |
turbo-${{ runner.os }}-
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
- run: yarn run ci
- run: yarn run docs
- uses: actions/upload-artifact@v2
with:
name: storybooks
path: |
packages/fuselage/storybook-static
packages/onboarding-ui/storybook-static
packages/layout/storybook-static
- uses: actions/upload-artifact@v2
with:
name: docs
path: |
static
- run: |
ref='${{ github.ref }}'
echo "::set-output name=branch-name::$(echo "${ref:11}")"
id: set-branch-name
- uses: actions/upload-artifact@v2
with:
name: build
path: packages/**/dist/*
publish-to-npm:
name: Publish to NPM
runs-on: ubuntu-latest
needs:
- build-and-test
steps:
- uses: actions/setup-node@v2
with:
node-version: "14.21.3"
registry-url: "https://registry.npmjs.org"
scope: "@rocket.chat"
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/cache@v2
id: yarn-cache
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- uses: actions/download-artifact@v2
with:
name: build
path: packages
- run: yarn install
if: steps.yarn-cache.outputs.cache-hit != 'true'
- name: Create Release Pull Request
id: changesets
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve workspace dependencies
if: steps.changesets.outputs.hasChangesets == 'false'
run: yarn resolve-workspace-deps
- name: Publish to npm
if: steps.changesets.outputs.hasChangesets == 'false'
uses: changesets/action@v1
with:
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-to-gh-pages:
name: Publish to GitHub Pages
runs-on: ubuntu-latest
needs:
- build-and-test
environment:
name: github-pages
url: "https://rocketchat.github.io/Rocket.Chat.Fuselage/fuselage/${{ needs.build-and-test.outputs.branch-name }}"
steps:
- uses: actions/checkout@v2
with:
ref: gh-pages
- uses: actions/download-artifact@v2
with:
name: storybooks
path: packages
- uses: actions/download-artifact@v2
with:
name: docs
path: .
- run: |
rm -rf "fuselage/${{ needs.build-and-test.outputs.branch-name }}" "layout/${{ needs.build-and-test.outputs.branch-name }}" "onboarding-ui/${{ needs.build-and-test.outputs.branch-name }}"
mv -v "packages/fuselage/storybook-static" "fuselage/${{ needs.build-and-test.outputs.branch-name }}"
mv -v "packages/onboarding-ui/storybook-static" "onboarding-ui/${{ needs.build-and-test.outputs.branch-name }}"
mv -v "packages/layout/storybook-static" "layout/${{ needs.build-and-test.outputs.branch-name }}"
rm -rf packages
- uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: .
commit_message: "Deploy to Github Pages [skip ci]"
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}