-
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (30 loc) · 1.12 KB
/
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
name: Portfolio Deploy
on:
push:
branches:
- main
jobs:
deployment:
runs-on: ubuntu-latest
environment: production
steps:
- name: deploy
deploy:
runs-on: ubuntu-latest
needs: test # this job depends on "test" having finished
if: github.ref == 'refs/heads/main' # 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 AWS
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 }}
run: |
cd ${{ secrets.APPDIR }}
git pull # we pull any changes from git
npm prune # we remove any unused dependencies
npm install # we install any missing dependencies
npm run build # we build our app
pm2 reload all # we reload the app via PM2