Deploy Inicial do SteelCheck com Docker Build Automatizado
This commit is contained in:
43
push_steelcheck.py
Normal file
43
push_steelcheck.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import subprocess
|
||||
import os
|
||||
import urllib.parse
|
||||
|
||||
# Configurações do Gitea
|
||||
GITEA_USER = "admtracksteel"
|
||||
GITEA_PASS = "@@Gi05Br;;"
|
||||
GITEA_URL = "git.reifonas.cloud:22222"
|
||||
GITEA_REPO = "SteelCheck"
|
||||
|
||||
# URL codificada para evitar problemas com caracteres especiais
|
||||
encoded_pass = urllib.parse.quote(GITEA_PASS)
|
||||
remote_url = f"https://{GITEA_USER}:{encoded_pass}@{GITEA_URL}/{GITEA_USER}/{GITEA_REPO}.git"
|
||||
|
||||
def run_command(command, description):
|
||||
print(f"Executando: {description}...")
|
||||
try:
|
||||
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
|
||||
print(f"Sucesso em {description}")
|
||||
return result.stdout
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Erro em {description}: {e.stderr}")
|
||||
return None
|
||||
|
||||
# Mudar para o diretório do projeto
|
||||
os.chdir(r"m:\OFICIAIS E FUNCIONANDO\SteelCheck_base")
|
||||
|
||||
# Inicializar Git se necessário
|
||||
if not os.path.exists(".git"):
|
||||
run_command("git init", "inicializar git")
|
||||
|
||||
# Configurar Git localmente para evitar erros de autenticação
|
||||
run_command(f'git remote remove origin', "limpar remote antigo")
|
||||
run_command(f'git remote add origin {remote_url}', "adicionar novo remote")
|
||||
|
||||
# Add e Commit
|
||||
run_command("git add .", "adicionar arquivos")
|
||||
run_command('git commit -m "Deploy Inicial do SteelCheck com Docker Build Automatizado"', "fazer commit inicial")
|
||||
|
||||
# Push final
|
||||
run_command("git push -u origin main --force", "fazer push para o Gitea")
|
||||
|
||||
print("\n--- Processo SteelCheck Concluído! ---")
|
||||
Reference in New Issue
Block a user