-
Notifications
You must be signed in to change notification settings - Fork 2
58 lines (44 loc) · 1.96 KB
/
beta.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
name: Deploy Beta
on:
push:
branches: [ master ]
jobs:
build-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Write SSH keys
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.BETA_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
echo "${{ vars.BETA_SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: 16
cache-dependency-path: |
frontend/yarn.lock
backend/yarn.lock
cache: 'yarn'
- name: Install Frontend Dependencies
working-directory: frontend
run: yarn install --frozen-lockfile
- name: Build Frontend
working-directory: frontend
run: CI=false yarn build; cp build/index.html build/404.html
- name: Install Docs Dependencies
working-directory: doc
run: yarn install
- name: Build Docs
working-directory: doc
run: yarn build; mv ./dist ../frontend/build/docs
- name: Make sure remote folder exists
run: ssh ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}} -p ${{vars.BETA_SSH_PORT}} "mkdir -p SNM-I"
- name: Rsync built frontend
run: rsync -rvz -e "ssh -p ${{vars.BETA_SSH_PORT}}" --progress --delete ./frontend/build/* ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}}:/home/ubuntu/SNM-I/frontend-build
- name: Rsync backend
run: rsync -rvz -e "ssh -p ${{vars.BETA_SSH_PORT}}" --progress --delete ./backend ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}}:/home/ubuntu/SNM-I/
- name: Rsync scripts
run: rsync -rvz -e "ssh -p ${{vars.BETA_SSH_PORT}}" --progress --delete ./scripts ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}}:/home/ubuntu/SNM-I/
- name: Update & Restart Backend
run: ssh ${{vars.BETA_SSH_USER}}@${{vars.BETA_SSH_HOST}} -p ${{vars.BETA_SSH_PORT}} "cd SNM-I && ./scripts/redeploy.sh"