-
Notifications
You must be signed in to change notification settings - Fork 1
22 lines (20 loc) · 1.09 KB
/
cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
name: server deployment
on: [push] # tells github to run this on any push to the repository
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' # we tell Github to only execute this step if we're on our master branch (so we don't put unfinished branches in production)
steps:
- name: Deploying to server
uses: appleboy/ssh-action@master # An action made to control Linux servers
with: # We set all our secrets here for the action, these won't be shown in the action logs
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
script: |
cd /home/${{ secrets.USERNAME }}/osm # we move into our app's folder
git pull # we pull any changes from git
npm prune # we remove any unused dependencies
npm install # we install any missing dependencies
pm2 reload osm --exp-backoff-restart-delay=100 --time # we reload the app via PM2; use "--max-memory-restart 1024M" if memory gets out of hand