setup: env for client and server changes #15
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: iConnect Server V1 | |
on: | |
pull_request: | |
branches: [main] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Debug Environment | |
run: | | |
echo "Current PATH: $PATH" | |
pm2 --version || true # Print pm2 version or continue if not found | |
npm --version || true # Print npm version or continue if not found | |
- name: Set PATH using environment file | |
run: | | |
echo '/home/azureuser/.nvm/versions/node/v20.10.0/bin' >> $GITHUB_PATH | |
- name: Deploy using SSH | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: 22 | |
script: | | |
cd /home/azureuser/iconnect | |
git pull origin main | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
git status | |
pm2 kill | |
export NODE_ENV=production | |
cd server | |
npm install | |
npm run tsc | |
npm run start:prod |