Skip to content

Commit 64d771e

Browse files
Merge pull request #357 from ayush-129/improve-deploy-scripts
Improving deploy scripts
2 parents 07d2e84 + bf85340 commit 64d771e

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

scripts/deploy.sh

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
1-
cd ..
2-
pwd
1+
#!/bin/bash
32

4-
yarn build
3+
# Exit script if any command fails
4+
set -e
55

6-
netlify deploy --prod
6+
# Navigate to the parent directory
7+
echo "Navigating to the parent directory..."
8+
cd .. || { echo "Failed to change directory! Exiting..."; exit 1; }
9+
10+
# Display the current directory
11+
echo "Current directory:"
12+
pwd || { echo "Failed to get current directory! Exiting..."; exit 1; }
13+
14+
# Install dependencies (if necessary) and build the project
15+
echo "Running build..."
16+
if yarn build; then
17+
echo "Build succeeded."
18+
else
19+
echo "Build failed! Exiting..."
20+
exit 1
21+
fi
22+
23+
# Deploy the project to Netlify (production environment)
24+
echo "Deploying to Netlify..."
25+
if netlify deploy --prod; then
26+
echo "Deployment to Netlify succeeded."
27+
else
28+
echo "Deployment to Netlify failed! Exiting..."
29+
exit 1
30+
fi
31+
32+
echo "Deployment completed successfully."

0 commit comments

Comments
 (0)