-
Notifications
You must be signed in to change notification settings - Fork 6
96 lines (96 loc) Β· 3.1 KB
/
develop-server.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
name: Server CI/CD on Branch 'develop/server'
on:
push:
branches: [ develop/server ]
paths: [ 'server/**' ]
pull_request:
branches: [ develop/server ]
paths: [ 'server/**' ]
workflow_dispatch:
defaults:
run:
shell: bash
working-directory: ./server
jobs:
test:
env:
MYSQL_DATABASE: areudonedb
MYSQL_USER: areudone
MYSQL_PASSWORD: 123123
MYSQL_ROOT_PASSWORD: 123123
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 12.x
- run: npm install
- run: npm run lint
- run: npm run build
- run: |
touch .env
touch .env.test
echo NODE_ENV=test >> .env
echo DATABASE_TYPE=mysql >> .env.test
echo DATABASE_URL=mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@localhost:3306/${MYSQL_DATABASE} >> .env.test
echo DATABASE_DROP_SCHEMA=false >> .env.test
echo DATABASE_SYNCHRONIZE=true >> .env.test
echo JWT_SECRET=sjfklajslfjaslfjals >> .env.test
echo OAUTH_NAVER_CLIENT_ID=vdEhOcPIbq3NUryKWnDh >> .env.test
echo OAUTH_GITHUB_CLIENT_ID=d3fcbc6215c7a37893f1 >> .env.test
cat .env.test
- run: npm run test
services:
db:
image: mysql:5.7
ports:
- 3306:3306
env:
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_USER: ${{ env.MYSQL_USER }}
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
deploy:
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version: 12.x
- run: npm install
- run: npm run build
- name: Create environment files
run: |
touch .env
touch .env.development
echo NODE_ENV=development >> .env
for env in $DEVELOP_SERVER_ENVIRONMENTS
do
echo $env >> .env.development
done
env:
DEVELOP_SERVER_ENVIRONMENTS: ${{ secrets.DEVELOP_SERVER_ENVIRONMENTS }}
- uses: appleboy/[email protected]
with:
host: ${{ secrets.DEVELOP_SERVER_HOST }}
port: ${{ secrets.DEVELOP_SERVER_PORT }}
username: ${{ secrets.DEVELOP_SERVER_USERNAME }}
password: ${{ secrets.DEVELOP_SERVER_PASSWORD }}
target: /home/${{ secrets.DEVELOP_SERVER_USERNAME }}
source: ./server
overwrite: true
- uses: appleboy/[email protected]
with:
host: ${{ secrets.DEVELOP_SERVER_HOST }}
port: ${{ secrets.DEVELOP_SERVER_PORT }}
username: ${{ secrets.DEVELOP_SERVER_USERNAME }}
password: ${{ secrets.DEVELOP_SERVER_PASSWORD }}
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
cd ~/server
pm2 reload ecosystem.config.js