-
Notifications
You must be signed in to change notification settings - Fork 162
141 lines (131 loc) · 4.21 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
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/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '22.2.0'
cache: 'yarn'
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- run: yarn
if: steps.yarn-cache.outputs.cache-hit != 'true'
- run: yarn run ci
- run: yarn run docs
- uses: actions/upload-artifact@v3
with:
name: storybooks
path: |
packages/fuselage/storybook-static
packages/onboarding-ui/storybook-static
packages/layout/storybook-static
- uses: actions/upload-artifact@v3
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@v3
with:
name: build
path: packages/**/dist/*
publish-to-npm:
name: Publish to NPM
runs-on: ubuntu-latest
needs:
- build-and-test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '22.2.0'
registry-url: 'https://registry.npmjs.org'
scope: '@rocket.chat'
cache: 'yarn'
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- uses: actions/download-artifact@v3
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/fuselage/fuselage/${{ needs.build-and-test.outputs.branch-name }}'
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/download-artifact@v3
with:
name: storybooks
path: packages
- uses: actions/download-artifact@v3
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 }}