Merge pull request #213 from samarsault/master #14
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: Build & Deploy | |
on: | |
push: | |
branches: [production] | |
jobs: | |
deploy: | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Deploy NodeJS app | |
uses: appleboy/[email protected] | |
with: | |
host: ${{secrets.SSH_HOST}} # IP address of the server you wish to ssh into | |
key: ${{secrets.SSH_KEY}} # Private or public key of the server | |
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into | |
script: | | |
echo 'Deployment Started' | |
export NVM_DIR=~/.nvm | |
source ~/noodle_env.sh | |
source ~/.nvm/nvm.sh | |
nvm use 12 | |
echo `node -v` | |
cd noodle | |
git checkout production | |
git pull origin production | |
cd client | |
npm i && npm run build | |
cd ../server | |
npm i | |
cd .. | |
pm2 stop ecosystem.config.js | |
pm2 start ecosystem.config.js | |
sudo service nginx restart | |
echo 'Deployment Complete' |