-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprepare_deployment.py
More file actions
59 lines (50 loc) · 1.96 KB
/
prepare_deployment.py
File metadata and controls
59 lines (50 loc) · 1.96 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
import subprocess
import sys
def run_command(command):
"""Run a command and return its output"""
try:
result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
return result.stdout.strip()
except subprocess.CalledProcessError as e:
print(f"Error executing command: {command}")
print(f"Error message: {e.stderr}")
return None
def main():
# Check if git is installed
if not run_command("git --version"):
print("Git is not installed or not in PATH. Please install Git and try again.")
return
# Check if we're in a git repository
if not os.path.exists(os.path.join(os.getcwd(), ".git")):
print("This directory is not a Git repository. Please initialize Git first.")
return
# Add the modified files
files_to_add = [
"tracker/urls.py",
"tracker/auth.py",
"tracker/views.py",
"amc_tracker/settings.py"
]
for file in files_to_add:
print(f"Adding {file}...")
run_command(f"git add {file}")
# Commit the changes
commit_message = "Fix sendgrid_settings URL pattern and enhance authentication logging"
print(f"Committing changes with message: {commit_message}")
run_command(f'git commit -m "{commit_message}"')
# Get the current branch
current_branch = run_command("git rev-parse --abbrev-ref HEAD")
if not current_branch:
print("Could not determine current branch. Please push manually.")
return
print("\n" + "="*50)
print(f"Changes committed successfully to branch '{current_branch}'")
print("To complete the deployment:")
print(f"1. Run: git push origin {current_branch}")
print("2. Go to your Render dashboard: https://dashboard.render.com/")
print("3. Select your web service")
print("4. Click 'Manual Deploy' and select 'Deploy latest commit'")
print("="*50)
if __name__ == "__main__":
main()