refactor: separate client and server into distinct npm packages and r… #23
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: "EC2 Deployment Pipeline" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: main-deployment | |
cancel-in-progress: true | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Install Dependencies | |
run: pnpm install --no-optional | |
- name: Lint the server code | |
run: pnpm run lint:server | |
- name: SSH into EC2 and Deploy | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.EC2_PORT }} | |
script: | | |
cd /home/${{ secrets.EC2_USERNAME }}/chatify | |
sudo git pull origin main | |
# Añadir el PATH a pnpm y pm2 | |
export PATH=$PATH:/home/ubuntu/.local/share/pnpm:/run/user/1000/fnm_multishells/12656_1717970489054/bin | |
pnpm install | |
pnpm run build:server | |
pm2 restart index --update-env |