This commit is contained in:
Skylar Grant 2021-10-19 19:01:24 -04:00
parent ba80d11628
commit faa5c161f7
2 changed files with 29 additions and 4 deletions

25
.github/workflows/dev_deploy.yaml vendored Normal file
View File

@ -0,0 +1,25 @@
name: NodBot Dev Deploy
on:
push: # tells github to run this on any push to the dev branch
branches:
- dev
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev' # we tell Github to only execute this step if we're on our dev branch
steps:
- name: Deploying to Probey
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: |
cd nodbot-dev # 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 nodbot-dev # we reload the app via PM2

View File

@ -1,16 +1,16 @@
name: Node.js CI/CD name: NodBot Production Deploy
on: on:
push: # tells github to run this on any push to the repository push: # tells github to run this on any push to the dev branch
branches: branches:
- main - main
jobs: jobs:
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # we tell Github to only execute this step if we're on our main branch (so we don't put unfinished branches in production) if: github.ref == 'refs/heads/main' # we tell Github to only execute this step if we're on our main branch
steps: steps:
- name: Deploying to Ayrenn - name: Deploying to Probey
uses: appleboy/ssh-action@master # An action made to control Linux servers 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 with: # We set all our secrets here for the action, these won't be shown in the action logs
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}