diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..adede75 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,37 @@ +name: Despliegue en EC2 + +on: + push: + branches: + - dev # Cambia 'dev' por la rama que desees + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout código + uses: actions/checkout@v4 + + - name: Copiar archivos al servidor + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: ${{ secrets.SSH_PORT }} + source: "." + target: "projects/RefaDiazFrontEnd" + + - name: Ejecutar comandos remotos + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: ${{ secrets.SSH_PORT }} + script: | + cd projects/RefaDiazFrontEnd + npm install + npm run build + pm2 restart RefaDiazApp