-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.py
More file actions
36 lines (29 loc) · 875 Bytes
/
deploy.py
File metadata and controls
36 lines (29 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import subprocess
def run_command(command):
print(f"_________________________\n\n\n")
print(f"Ejecutando: {command}")
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
output = process.stdout.readline()
if not output and process.poll() is not None:
break
if output:
print(output.strip().decode())
rc = process.poll()
if rc != 0:
print('Error al ejecutar el comando: ', command)
print('Abortando el script...')
exit(1)
else:
print(f"{command} Done!")
commands = [
"git pull",
"pnpm i",
"pnpx prisma migrate deploy",
"pnpx prisma generate",
"pnpm run build",
"pm2 reload tinta-planner",
]
for command in commands:
run_command(command)
print("Deploy completado con éxito.")