Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
name: CI
name: Deploy PyDay

on: [push]
on:
push:
branches:
- main

jobs:
deploy-prod:
if: github.ref == 'refs/heads/main'
runs-on: [ubuntu-latest]
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Push to server
uses: appleboy/ssh-action@v1.0.3
- name: Checkout codigo
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Instalacion dependencies & build
run: |
npm ci
npm run build

- name: Copia archivos hacia droplet
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.PYDAY_SERVER }}
username: ${{ secrets.PYDAY_USER }}
password: ${{ secrets.PYDAY_PASS }}
port: ${{ secrets.PYDAY_PORT }}
source: ".next/,public,next.config.js,package.json,package-lock.json"
target: "/home/pyday"

- name: Iniciar app con PM2 en el servidor
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.PYDAY_SERVER }}
username: ${{ secrets.PYDAY_USER }}
password: ${{ secrets.PYDAY_PASS }}
port: ${{ secrets.PYDAY_PORT }}
script: |
cd /home/pyday
ls -l
sh deploy.sh
npm install --omit=dev
pm2 delete pyday || true
pm2 start npm --name "pyday" -- start