nodbot/.github/workflows/prod_deploy.yaml

26 lines
966 B
YAML
Raw Normal View History

2021-10-19 23:01:24 +00:00
name: NodBot Production Deploy
2021-09-29 19:04:51 +00:00
2021-10-19 22:57:45 +00:00
on:
2021-10-19 23:01:24 +00:00
push: # tells github to run this on any push to the dev branch
2021-10-19 22:57:45 +00:00
branches:
- main
2021-09-29 19:04:51 +00:00
jobs:
deploy:
runs-on: ubuntu-latest
2021-10-19 23:01:24 +00:00
if: github.ref == 'refs/heads/main' # we tell Github to only execute this step if we're on our main branch
2021-09-29 19:04:51 +00:00
steps:
2021-10-19 23:01:24 +00:00
- name: Deploying to Probey
2021-09-29 19:04:51 +00:00
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 }}
key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }}
script: |
2021-10-19 22:57:45 +00:00
cd nodbot # we move into our app's folder
2021-09-29 19:04:51 +00:00
git pull # we pull any changes from git
npm prune # we remove any unused dependencies
npm install # we install any missing dependencies
2021-10-19 22:57:45 +00:00
pm2 reload nodbot # we reload the app via PM2