-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.1 KB
/
prod-cicd.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
name: Deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
production:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎
uses: actions/checkout@master
- name: Install dependencies 👨🏻💻
run: npm i
- name: Build for production 🏗️
run: npm run build
- name: Setup SSH
run: |
mkdir -p ~/.ssh/
echo "${{ secrets.SSH_PRIV_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_PUB_KEY }}" > ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa.pub
ssh-keyscan -H ${{ secrets.SSH_IP }} >> ~/.ssh/known_hosts
- name: Copy builds to server
run: |
rsync -vrm --delete dist package.json package-lock.json ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}:/var/www/test-api.gomint.me/
- name: Install dependencies on server and reload pm2
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} << 'EOF'
cd /var/www/test-api.gomint.me/
npm ci
pm2 reload 0
EOF