Skip to content

Update deploy.yml

Update deploy.yml #3

Workflow file for this run

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