-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
46 lines (35 loc) · 939 Bytes
/
deploy.sh
File metadata and controls
46 lines (35 loc) · 939 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
37
38
39
40
41
42
43
44
45
46
git checkout gh-pages
git pull
# Variables
TARGET_BRANCH="gh-pages"
SOURCE_BRANCH="develop"
# Ensure the script stops on errors
set -e
# Fetch latest changes from the remote repository
git fetch origin
# Checkout the target branch
echo "Switching to $TARGET_BRANCH branch..."
git checkout $TARGET_BRANCH
# Pull the latest changes
echo "Pulling latest changes for $TARGET_BRANCH..."
git pull origin $TARGET_BRANCH
# Merge the source branch
echo "Merging $SOURCE_BRANCH into $TARGET_BRANCH..."
git merge $SOURCE_BRANCH
# Build the changes
echo "Building changes..."
ng build --output-path docs --base-href ./
# Move files
echo "Moving files..."
mv ./docs/browser/* ./docs/
cp ./CNAME ./docs/
cp ./docs/index.html docs/404.html
# commit and push
echo "Commiting..."
CURRENT_DATE=$(date "+%Y-%m-%d")
MESSAGE="deployment "
COMMIT_MESSAGE="$MESSAGE - $CURRENT_DATE"
git add .
git commit -m "$COMMIT_MESSAGE"
echo "Pushing..."
git push