Se añade un workflow
This commit is contained in:
39
.gitea/workflows/upload.yaml
Normal file
39
.gitea/workflows/upload.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Compilar y subir al Servidor
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [labeled]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
if: github.event.label.name == 'deploy'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '22' # Ajusta a la versión de Node.js que necesites
|
||||
|
||||
- name: Instalar Dependencias
|
||||
run: npm ci
|
||||
|
||||
- name: Compilar
|
||||
run: npm run build
|
||||
|
||||
- name: Instalar ssh
|
||||
run: sudo apt-get install sshpass
|
||||
|
||||
- name: Subir al servidor
|
||||
env:
|
||||
SERVER_IP: ${{ secrets.SERVER_IP }}
|
||||
SERVER_USER: ${{ secrets.SERVER_USER }}
|
||||
SERVER_PASS: ${{ secrets.SERVER_PASS }}
|
||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||
run: |
|
||||
# Borra la copia anterior
|
||||
sshpass -p $SERVER_PASS ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "rm -rf $DEPLOY_PATH/*"
|
||||
# Sube la nueva versión
|
||||
sshpass -p $SERVER_PASS scp -o StrictHostKeyChecking=no -r dist/* $SERVER_USER@$SERVER_IP:$DEPLOY_PATH
|
||||
Reference in New Issue
Block a user