forked from FrankTehila/devops_mbj_frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
64 lines (55 loc) · 1.53 KB
/
deploy.sh
File metadata and controls
64 lines (55 loc) · 1.53 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
60
61
62
63
64
#!/bin/bash
# הדפסת הודעה על התחלת התהליך
echo "Starting the deployment process..."
# שלב 1: בדיקת סטטוס Git
echo "Checking Git status..."
git status
if [ $? -ne 0 ]; then
echo "Error: git status failed!"
exit 1
fi
# שלב 2: הוספת כל השינויים (סטייג'ינג)
echo "Staging all changes..."
git add .
if [ $? -ne 0 ]; then
echo "Error: git add failed!"
exit 1
fi
# שלב 3: יצירת Commit עם הודעת אוטומטית
commit_message="Change made"
echo "Committing changes with message: $commit_message"
git commit -m "$commit_message"
if [ $? -ne 0 ]; then
echo "Error: nothing in commit!"
exit 1
fi
# שלב 4: Push ל-GitHub
echo "Pushing changes to GitHub..."
git push origin main
if [ $? -ne 0 ]; then
echo "Error: git push failed!"
exit 1
fi
# שלב 5: התקנת תלותים
echo "Installing dependencies..."
npm install
if [ $? -ne 0 ]; then
echo "Error: npm install failed!"
exit 1
fi
# שלב 6: בניית האפליקציה
echo "Building the app..."
npm run build
if [ $? -ne 0 ]; then
echo "Error: npm run build failed!"
exit 1
fi
# שלב 7: העלאת קבצים ל-GCS
echo "Uploading build to Google Cloud Storage (GCS)..."
gcloud storage cp -r ./build/* gs:// rachel-fried-bucket-2
if [ $? -ne 0 ]; then
echo "Error: gcloud storage upload failed!"
exit 1
fi
# הודעה על סיום ההפעלה
echo "Deployment process completed successfully!"