Skip to content

Commit 2c7e284

Browse files
authored
Update main.yml
1 parent 273e55a commit 2c7e284

1 file changed

Lines changed: 40 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,51 @@
1-
name: CI
1+
name: Deploy PyDay
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- main
47

58
jobs:
6-
deploy-prod:
7-
if: github.ref == 'refs/heads/main'
8-
runs-on: [ubuntu-latest]
9+
deploy:
10+
runs-on: ubuntu-latest
911
steps:
10-
- uses: actions/checkout@v1
11-
- name: Push to server
12-
uses: appleboy/ssh-action@v1.0.3
12+
- name: Checkout codigo
13+
uses: actions/checkout@v4
14+
15+
- name: Ruta actual de trabajo
16+
run: |
17+
echo "Ruta actual de app pyday: $(pwd)"
18+
ls -la
19+
20+
- name: Setup node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
25+
- name: Instalacion dependencies & build
26+
run: |
27+
npm ci
28+
npm run build
29+
30+
- name: Copia archivos hacia droplet
31+
uses: appleboy/scp-action@v1
32+
with:
33+
host: ${{ secrets.PYDAY_SERVER }}
34+
username: ${{ secrets.PYDAY_USER }}
35+
password: ${{ secrets.PYDAY_PASS }}
36+
port: ${{ secrets.PYDAY_PORT }}
37+
source: ".next/,public,next.config.js,package.json,package-lock.json"
38+
target: "/home/pyday"
39+
40+
- name: Iniciar app con PM2 en el servidor
41+
uses: appleboy/ssh-action@v1
1342
with:
1443
host: ${{ secrets.PYDAY_SERVER }}
1544
username: ${{ secrets.PYDAY_USER }}
1645
password: ${{ secrets.PYDAY_PASS }}
1746
port: ${{ secrets.PYDAY_PORT }}
1847
script: |
1948
cd /home/pyday
20-
ls -l
21-
sh deploy.sh
49+
npm install --omit=dev
50+
pm2 delete pyday || true
51+
pm2 start npm --name "pyday" -- start

0 commit comments

Comments
 (0)