Deploy to prod on push #83
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to prod on push | |
on: | |
workflow_run: | |
workflows: ['Lint'] | |
types: | |
- completed | |
push: | |
paths: | |
- src/** | |
- .github/workflows/lint.yml | |
- .github/workflows/prod.yml | |
branches: [prod] | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Pull and install | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST_PROD }} | |
username: ${{ secrets.SSH_USERNAME_PROD }} | |
port: ${{ secrets.SSH_PORT_PROD }} | |
password: ${{ secrets.SSH_PASSWORD_PROD }} | |
script: | | |
source ~/.bashrc | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | |
cd crm-bot && git fetch --all && git reset --hard origin/prod && yarn install && pm2 delete crm-bot && yarn pm2 |