-
Notifications
You must be signed in to change notification settings - Fork 32
75 lines (73 loc) · 2.58 KB
/
workflow.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
name: Tests and release
on:
push:
branches:
- master
- beta
- v5
pull_request:
branches:
- master
- beta
- v5
jobs:
workflow:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: |
npm ci
- name: Build
run: |
npm run build:prod
- name: Linting
run: |
npm run lint
- name: Unit tests
run: |
npm run test:ci
- name: Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Deploy sample app to Vercel
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PROJECT_ID }}
STREAM_API_KEY: ${{ vars.STREAM_DEMO_API_KEY }}
STREAM_TOKEN_URL: ${{ vars.STREAM_DEMO_TOKEN_URL }}
STREAM_USER_ID: <dynamic user>
STREAM_CHANNELS_FILTER: '{"type": "messaging"}'
run: >
yarn vercel pull --yes --environment=${{ github.ref == 'refs/heads/v5' && 'production' || 'preview' }} --token=${{ secrets.VERCEL_TOKEN }} &&
yarn vercel build ${{ github.ref == 'refs/heads/v5' && '--prod' || '' }} --token=${{ secrets.VERCEL_TOKEN }} &&
yarn vercel deploy ${{ github.ref == 'refs/heads/v5' && '--prod' || '' }} --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
- name: Copy docs from stream-chat-css
run: npm run ${{ (github.ref == 'refs/heads/v5' || contains(github.head_ref, 'v5')) && 'copy-css-docs:v5' || 'copy-css-docs' }}
- name: Generate docs
run: |
npm run ${{ (github.ref == 'refs/heads/v5' || contains(github.head_ref, 'v5')) && 'generate-docs:v5' || 'generate-docs' }}
- name: Push to docusaurus
uses: GetStream/push-stream-chat-docusaurus-action@main
with:
target-branch: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/v5') && 'production' || 'staging' }}
env:
DOCUSAURUS_GH_TOKEN: ${{ secrets.DOCUSAURUS_GH_TOKEN }}