-
Notifications
You must be signed in to change notification settings - Fork 2
36 lines (29 loc) · 1012 Bytes
/
deploy.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
name: Deploy Frontend
on:
push:
branches:
- main
jobs:
deploy:
runs-on: Ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install SSH Agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_VCM }}
- name: Pull New Changes
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.VCM_HOST_USERNAME }}@${{ secrets.VCM_HOST_DNS }} 'sudo cd ${{secrets.VCM_FRONTEND_DIR}}
&& sudo git pull origin main'
- name: Build the changes and deploy
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.VCM_HOST_USERNAME }}@${{ secrets.VCM_HOST_DNS }} << EOF
sudo cd ${{ secrets.VCM_FRONTEND_DIR }}
sudo npm install --legacy-peer-deps
sudo npm run build
sudo rm -rf /var/www/*
sudo cp -r dist/* /var/www/
sudo systemctl restart nginx
EOF