Skip to content

Commit c9a89f0

Browse files
authored
Merge pull request #32 from python-chile/pch-change-31-archivo-yml
Update main.yml
2 parents 273e55a + f8760e7 commit c9a89f0

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
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: Setup node
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
20+
- name: Instalacion dependencies & build
21+
run: |
22+
npm ci
23+
npm run build
24+
25+
- name: Copia archivos hacia droplet
26+
uses: appleboy/scp-action@v1
27+
with:
28+
host: ${{ secrets.PYDAY_SERVER }}
29+
username: ${{ secrets.PYDAY_USER }}
30+
password: ${{ secrets.PYDAY_PASS }}
31+
port: ${{ secrets.PYDAY_PORT }}
32+
source: ".next/,public,next.config.js,package.json,package-lock.json"
33+
target: "/home/pyday"
34+
35+
- name: Iniciar app con PM2 en el servidor
36+
uses: appleboy/ssh-action@v1
1337
with:
1438
host: ${{ secrets.PYDAY_SERVER }}
1539
username: ${{ secrets.PYDAY_USER }}
1640
password: ${{ secrets.PYDAY_PASS }}
1741
port: ${{ secrets.PYDAY_PORT }}
1842
script: |
1943
cd /home/pyday
20-
ls -l
21-
sh deploy.sh
44+
npm install --omit=dev
45+
pm2 delete pyday || true
46+
pm2 start npm --name "pyday" -- start

0 commit comments

Comments
 (0)