-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (55 loc) · 1.65 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
name: CI
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v2
with:
node-version: 20
- name: Install dependencies
run: yarn
- name: Create db bank file
run: cp ormconfig.example.json ormconfig.json
- name: Build
run: yarn build
- name: Docker compose up
run: docker-compose up -d
- name: Wait for Services to Start
run: sleep 60
- name: Run migrations
run: yarn typeorm migration:run
- name: Run seed
run: yarn seed:admin
- name: Run application
run: yarn dev &
- name: Wait for Services to Start
run: sleep 30
- name: Run tests
run: yarn test
- name: Copy file via ssh key
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
source: "., !node_modules, !docker-compose.yml, !ormconfig.json"
target: "~/rentapi"
- name: Update API
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
script: |
cd ~/rentapi
yarn
./node_modules/.bin/typeorm migration:run
pm2 restart server