-
Notifications
You must be signed in to change notification settings - Fork 40
158 lines (128 loc) · 4.19 KB
/
main.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
148
149
150
151
152
153
154
155
156
157
name: Zuri Whiteboard Deployment Pipeline
on:
# Triggers the workflow on push or pull request events but for the dev branch
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
- name: Prettify code
uses: creyD/[email protected]
with:
# This part is also where you can pass other options, for example:
prettier_options: --write **/*.{js,md}
commit_message: Prettier Action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# fe_eslint:
# needs: prettier
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# # Make sure the actual branch is checked out when running on pull requests
# ref: ${{ github.head_ref }}
# - name: Use cached node_modules
# uses: c-hive/gha-yarn-cache@v2
# with:
# directory: client
# - name: Install yarn dependencies and Run ESLint for client
# run: |
# cd client
# yarn install
# yarn run lint --fix
# - name: Use cached node_modules
# uses: c-hive/gha-yarn-cache@v2
# with:
# directory: chess
# - name: Install yarn dependencies and Run ESLint for main app
# run: |
# cd chess
# yarn install
# yarn run lint --fix
# - name: Commit changes
# if: always()
# uses: stefanzweifel/[email protected]
# with:
# commit_message: Frontend EsLint Fixes
# be_eslint:
# needs: fe_eslint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# with:
# # Make sure the actual branch is checked out when running on pull requests
# ref: ${{ github.head_ref }}
# - name: Use cached node_modules
# uses: c-hive/gha-yarn-cache@v2
# with:
# directory: server
# - name: Install yarn dependencies and Run ESLint
# run: |
# cd server
# yarn install
# yarn run lint --fix
# - name: Commit changes
# if: always()
# uses: stefanzweifel/[email protected]
# with:
# commit_message: Backend EsLint Fixes
deploy:
# needs: be_eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install yarn dependencies and build project
run: |
cd backend
yarn build
- name: Deployment
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ZURI_MAIN_HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /var/www/zc_plugin_whiteboard/
git branch -M main
git stash
git fetch --all
git reset --hard origin/main
cd backend
yarn install
yarn build
# - name: Copy frontend dist folder to server
# uses: Creepios/[email protected]
# with:
# host: ${{ secrets.HOSTNAME }}
# username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
# localPath: './frontend/dist/'
# remotePath: '/var/www/zc_plugin_whiteboard/frontend/dist'
# - name: Copy SPA Root dist folder to server
# uses: Creepios/[email protected]
# with:
# host: ${{ secrets.HOSTNAME }}
# username: ${{ secrets.USERNAME }}
# password: ${{ secrets.PASSWORD }}
# localPath: './whiteboard-root/dist/'
# remotePath: '/var/www/zc_plugin_whiteboard/whiteboard-root/dist'
- name: Restart PM2 Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.ZURI_MAIN_HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
script: |
cd /var/www/zc_plugin_whiteboard/backend
PM2_HOME=/opt/pm2/.pm2 pm2 restart whiteboard